From afaa1d754d81d1b7a374ad8318bde23b4078e539 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sat, 14 Dec 2024 01:01:43 +0000 Subject: [PATCH] feat: added SqlCondition in AlertPolicy feat: added PrometheusQueryLanguageCondition.disable_metric_validation feat: deprecated QueryTimeSeries (MQL query endpoint) feat: added TimeSeries.description for input only docs: TimeSeries.unit allows limited updating by CreateTimeSeries docs: ServiceLevelObjective.goal must be <= 0.9999 docs: ServiceAgentAuthentication supports generating an OAuth token For more information about the status of MQL, see the [MQL deprecation notice](https://cloud.google.com/stackdriver/docs/deprecations/mql). PiperOrigin-RevId: 706010293 Source-Link: https://github.com/googleapis/googleapis/commit/f4eff5440fd07389f820d22d2a55690c6390dc6d Source-Link: https://github.com/googleapis/googleapis-gen/commit/adad43ebe0c959917a5d93348c22b95db62e65a1 Copy-Tag: eyJwIjoiTW9uaXRvcmluZy8uT3dsQm90LnlhbWwiLCJoIjoiYWRhZDQzZWJlMGM5NTk5MTdhNWQ5MzM0OGMyMmI5NWRiNjJlNjVhMSJ9 --- .../Google/Monitoring/V3/Alert.php | Bin 0 -> 7280 bytes .../Google/Monitoring/V3/AlertService.php | 64 + .../Google/Monitoring/V3/Common.php | Bin 0 -> 2539 bytes .../Google/Monitoring/V3/DroppedLabels.php | 33 + .../Google/Monitoring/V3/Group.php | 37 + .../Google/Monitoring/V3/GroupService.php | Bin 0 -> 3723 bytes .../Google/Monitoring/V3/Metric.php | Bin 0 -> 2669 bytes .../Google/Monitoring/V3/MetricService.php | Bin 0 -> 7141 bytes .../Google/Monitoring/V3/MutationRecord.php | 32 + .../Google/Monitoring/V3/Notification.php | Bin 0 -> 2943 bytes .../Monitoring/V3/NotificationService.php | 97 ++ .../Google/Monitoring/V3/QueryService.php | 32 + .../Google/Monitoring/V3/Service.php | Bin 0 -> 5715 bytes .../Google/Monitoring/V3/ServiceService.php | 95 ++ .../Google/Monitoring/V3/Snooze.php | 39 + .../Google/Monitoring/V3/SnoozeService.php | 56 + .../Google/Monitoring/V3/SpanContext.php | 29 + .../Google/Monitoring/V3/Uptime.php | Bin 0 -> 6133 bytes .../Google/Monitoring/V3/UptimeService.php | 72 + .../Cloud/Monitoring/V3/Aggregation.php | 389 ++++++ .../Monitoring/V3/Aggregation/Aligner.php | 269 ++++ .../Monitoring/V3/Aggregation/Reducer.php | 191 +++ .../Cloud/Monitoring/V3/AlertPolicy.php | 805 +++++++++++ .../V3/AlertPolicy/AlertStrategy.php | 217 +++ .../NotificationChannelStrategy.php | 139 ++ .../AlertStrategy/NotificationPrompt.php | 64 + .../AlertStrategy/NotificationRateLimit.php | 81 ++ .../Monitoring/V3/AlertPolicy/Condition.php | 406 ++++++ .../Condition/EvaluationMissingData.php | 76 ++ .../V3/AlertPolicy/Condition/LogMatch.php | 151 +++ .../AlertPolicy/Condition/MetricAbsence.php | 304 +++++ .../AlertPolicy/Condition/MetricThreshold.php | 635 +++++++++ .../MetricThreshold/ForecastOptions.php | 101 ++ .../MonitoringQueryLanguageCondition.php | 257 ++++ .../PrometheusQueryLanguageCondition.php | 491 +++++++ .../V3/AlertPolicy/Condition/SqlCondition.php | 303 +++++ .../Condition/SqlCondition/BooleanTest.php | 75 ++ .../Condition/SqlCondition/Daily.php | 126 ++ .../Condition/SqlCondition/Hourly.php | 130 ++ .../Condition/SqlCondition/Minutes.php | 78 ++ .../Condition/SqlCondition/RowCountTest.php | 109 ++ .../V3/AlertPolicy/Condition/Trigger.php | 118 ++ .../V3/AlertPolicy/ConditionCombinerType.php | 81 ++ .../V3/AlertPolicy/Documentation.php | 245 ++++ .../V3/AlertPolicy/Documentation/Link.php | 124 ++ .../Monitoring/V3/AlertPolicy/Severity.php | 75 ++ .../Google/Cloud/Monitoring/V3/BasicSli.php | 269 ++++ .../V3/BasicSli/AvailabilityCriteria.php | 36 + .../V3/BasicSli/LatencyCriteria.php | 84 ++ .../Cloud/Monitoring/V3/ComparisonType.php | 90 ++ .../V3/CreateAlertPolicyRequest.php | 188 +++ .../Monitoring/V3/CreateGroupRequest.php | 181 +++ .../V3/CreateMetricDescriptorRequest.php | 151 +++ .../V3/CreateNotificationChannelRequest.php | 163 +++ .../V3/CreateServiceLevelObjectiveRequest.php | 185 +++ .../Monitoring/V3/CreateServiceRequest.php | 180 +++ .../Monitoring/V3/CreateSnoozeRequest.php | 149 +++ .../Monitoring/V3/CreateTimeSeriesError.php | 135 ++ .../Monitoring/V3/CreateTimeSeriesRequest.php | 159 +++ .../Monitoring/V3/CreateTimeSeriesSummary.php | 135 ++ .../V3/CreateTimeSeriesSummary/Error.php | 114 ++ .../V3/CreateUptimeCheckConfigRequest.php | 142 ++ .../V3/DeleteAlertPolicyRequest.php | 93 ++ .../Monitoring/V3/DeleteGroupRequest.php | 130 ++ .../V3/DeleteMetricDescriptorRequest.php | 103 ++ .../V3/DeleteNotificationChannelRequest.php | 138 ++ .../V3/DeleteServiceLevelObjectiveRequest.php | 92 ++ .../Monitoring/V3/DeleteServiceRequest.php | 87 ++ .../V3/DeleteUptimeCheckConfigRequest.php | 87 ++ .../Cloud/Monitoring/V3/DistributionCut.php | 127 ++ .../Cloud/Monitoring/V3/DroppedLabels.php | 80 ++ .../Monitoring/V3/GetAlertPolicyRequest.php | 87 ++ .../Cloud/Monitoring/V3/GetGroupRequest.php | 87 ++ .../V3/GetMetricDescriptorRequest.php | 103 ++ .../GetMonitoredResourceDescriptorRequest.php | 98 ++ ...etNotificationChannelDescriptorRequest.php | 87 ++ .../V3/GetNotificationChannelRequest.php | 87 ++ ...ficationChannelVerificationCodeRequest.php | 167 +++ ...icationChannelVerificationCodeResponse.php | 131 ++ .../V3/GetServiceLevelObjectiveRequest.php | 138 ++ .../Cloud/Monitoring/V3/GetServiceRequest.php | 87 ++ .../Cloud/Monitoring/V3/GetSnoozeRequest.php | 88 ++ .../V3/GetUptimeCheckConfigRequest.php | 87 ++ .../src/Google/Cloud/Monitoring/V3/Group.php | 257 ++++ .../Cloud/Monitoring/V3/GroupResourceType.php | 66 + .../Cloud/Monitoring/V3/InternalChecker.php | 271 ++++ .../Monitoring/V3/InternalChecker/State.php | 74 ++ .../Google/Cloud/Monitoring/V3/LabelValue.php | 141 ++ .../V3/ListAlertPoliciesRequest.php | 298 +++++ .../V3/ListAlertPoliciesResponse.php | 147 ++ .../Monitoring/V3/ListGroupMembersRequest.php | 277 ++++ .../V3/ListGroupMembersResponse.php | 143 ++ .../Cloud/Monitoring/V3/ListGroupsRequest.php | 316 +++++ .../Monitoring/V3/ListGroupsResponse.php | 109 ++ .../V3/ListMetricDescriptorsRequest.php | 242 ++++ .../V3/ListMetricDescriptorsResponse.php | 113 ++ ...istMonitoredResourceDescriptorsRequest.php | 222 ++++ ...stMonitoredResourceDescriptorsResponse.php | 113 ++ ...tNotificationChannelDescriptorsRequest.php | 206 +++ ...NotificationChannelDescriptorsResponse.php | 117 ++ .../V3/ListNotificationChannelsRequest.php | 307 +++++ .../V3/ListNotificationChannelsResponse.php | 151 +++ .../V3/ListServiceLevelObjectivesRequest.php | 257 ++++ .../V3/ListServiceLevelObjectivesResponse.php | 109 ++ .../Monitoring/V3/ListServicesRequest.php | 275 ++++ .../Monitoring/V3/ListServicesResponse.php | 109 ++ .../Monitoring/V3/ListSnoozesRequest.php | 252 ++++ .../Monitoring/V3/ListSnoozesResponse.php | 106 ++ .../Monitoring/V3/ListTimeSeriesRequest.php | 501 +++++++ .../ListTimeSeriesRequest/TimeSeriesView.php | 59 + .../Monitoring/V3/ListTimeSeriesResponse.php | 201 +++ .../V3/ListUptimeCheckConfigsRequest.php | 230 ++++ .../V3/ListUptimeCheckConfigsResponse.php | 155 +++ .../V3/ListUptimeCheckIpsRequest.php | 129 ++ .../V3/ListUptimeCheckIpsResponse.php | 125 ++ .../Cloud/Monitoring/V3/MutationRecord.php | 111 ++ .../Monitoring/V3/NotificationChannel.php | 594 +++++++++ .../VerificationStatus.php | 76 ++ .../V3/NotificationChannelDescriptor.php | 326 +++++ .../src/Google/Cloud/Monitoring/V3/Point.php | 153 +++ .../Google/Cloud/Monitoring/V3/QueryError.php | 115 ++ .../Cloud/Monitoring/V3/QueryErrorList.php | 105 ++ .../Monitoring/V3/QueryTimeSeriesRequest.php | 200 +++ .../Monitoring/V3/QueryTimeSeriesResponse.php | 198 +++ .../src/Google/Cloud/Monitoring/V3/Range.php | 101 ++ .../Cloud/Monitoring/V3/RequestBasedSli.php | 121 ++ ...ficationChannelVerificationCodeRequest.php | 81 ++ .../Google/Cloud/Monitoring/V3/Service.php | 608 +++++++++ .../Cloud/Monitoring/V3/Service/AppEngine.php | 78 ++ .../Monitoring/V3/Service/BasicService.php | 130 ++ .../Monitoring/V3/Service/CloudEndpoints.php | 78 ++ .../Cloud/Monitoring/V3/Service/CloudRun.php | 120 ++ .../Monitoring/V3/Service/ClusterIstio.php | 198 +++ .../Cloud/Monitoring/V3/Service/Custom.php | 38 + .../Monitoring/V3/Service/GkeNamespace.php | 182 +++ .../Monitoring/V3/Service/GkeService.php | 219 +++ .../Monitoring/V3/Service/GkeWorkload.php | 250 ++++ .../V3/Service/IstioCanonicalService.php | 171 +++ .../Cloud/Monitoring/V3/Service/MeshIstio.php | 151 +++ .../Cloud/Monitoring/V3/Service/Telemetry.php | 74 ++ .../Monitoring/V3/ServiceLevelIndicator.php | 153 +++ .../Monitoring/V3/ServiceLevelObjective.php | 338 +++++ .../V3/ServiceLevelObjective/View.php | 71 + .../Cloud/Monitoring/V3/ServiceTier.php | 74 ++ .../src/Google/Cloud/Monitoring/V3/Snooze.php | 224 ++++ .../Cloud/Monitoring/V3/Snooze/Criteria.php | 88 ++ .../Cloud/Monitoring/V3/SpanContext.php | 91 ++ .../Monitoring/V3/SyntheticMonitorTarget.php | 75 ++ .../CloudFunctionV2Target.php | 134 ++ .../Cloud/Monitoring/V3/TextLocator.php | 303 +++++ .../Monitoring/V3/TextLocator/Position.php | 108 ++ .../Cloud/Monitoring/V3/TimeInterval.php | 165 +++ .../Google/Cloud/Monitoring/V3/TimeSeries.php | 454 +++++++ .../Cloud/Monitoring/V3/TimeSeriesData.php | 114 ++ .../V3/TimeSeriesData/PointData.php | 116 ++ .../Monitoring/V3/TimeSeriesDescriptor.php | 101 ++ .../TimeSeriesDescriptor/ValueDescriptor.php | 184 +++ .../Cloud/Monitoring/V3/TimeSeriesRatio.php | 180 +++ .../Google/Cloud/Monitoring/V3/TypedValue.php | 213 +++ .../V3/UpdateAlertPolicyRequest.php | 239 ++++ .../Monitoring/V3/UpdateGroupRequest.php | 134 ++ .../V3/UpdateNotificationChannelRequest.php | 151 +++ .../V3/UpdateServiceLevelObjectiveRequest.php | 139 ++ .../Monitoring/V3/UpdateServiceRequest.php | 139 ++ .../Monitoring/V3/UpdateSnoozeRequest.php | 227 ++++ .../V3/UpdateUptimeCheckConfigRequest.php | 192 +++ .../Cloud/Monitoring/V3/UptimeCheckConfig.php | 748 +++++++++++ .../V3/UptimeCheckConfig/CheckerType.php | 69 + .../V3/UptimeCheckConfig/ContentMatcher.php | 158 +++ .../ContentMatcher/ContentMatcherOption.php | 107 ++ .../ContentMatcher/JsonPathMatcher.php | 114 ++ .../JsonPathMatcher/JsonPathMatcherOption.php | 68 + .../V3/UptimeCheckConfig/HttpCheck.php | 730 ++++++++++ .../HttpCheck/BasicAuthentication.php | 107 ++ .../HttpCheck/ContentType.php | 67 + .../HttpCheck/RequestMethod.php | 64 + .../HttpCheck/ResponseStatusCode.php | 112 ++ .../ResponseStatusCode/StatusClass.php | 92 ++ .../HttpCheck/ServiceAgentAuthentication.php | 75 ++ .../ServiceAgentAuthenticationType.php | 57 + .../V3/UptimeCheckConfig/PingConfig.php | 72 + .../V3/UptimeCheckConfig/ResourceGroup.php | 113 ++ .../V3/UptimeCheckConfig/TcpCheck.php | 122 ++ .../Cloud/Monitoring/V3/UptimeCheckIp.php | 160 +++ .../Cloud/Monitoring/V3/UptimeCheckRegion.php | 102 ++ .../V3/VerifyNotificationChannelRequest.php | 147 ++ .../Cloud/Monitoring/V3/WindowsBasedSli.php | 236 ++++ .../V3/WindowsBasedSli/MetricRange.php | 125 ++ .../WindowsBasedSli/PerformanceThreshold.php | 146 ++ .../create_alert_policy.php | 88 ++ .../delete_alert_policy.php | 77 ++ .../get_alert_policy.php | 73 + .../list_alert_policies.php | 85 ++ .../update_alert_policy.php | 66 + .../V3/GroupServiceClient/create_group.php | 76 ++ .../V3/GroupServiceClient/delete_group.php | 71 + .../V3/GroupServiceClient/get_group.php | 73 + .../GroupServiceClient/list_group_members.php | 78 ++ .../V3/GroupServiceClient/list_groups.php | 79 ++ .../V3/GroupServiceClient/update_group.php | 60 + .../create_metric_descriptor.php | 81 ++ .../create_service_time_series.php | 84 ++ .../create_time_series.php | 82 ++ .../delete_metric_descriptor.php | 77 ++ .../get_metric_descriptor.php | 77 ++ .../get_monitored_resource_descriptor.php | 79 ++ .../list_metric_descriptors.php | 79 ++ .../list_monitored_resource_descriptors.php | 79 ++ .../MetricServiceClient/list_time_series.php | 99 ++ .../create_notification_channel.php | 87 ++ .../delete_notification_channel.php | 79 ++ .../get_notification_channel.php | 80 ++ .../get_notification_channel_descriptor.php | 77 ++ ...notification_channel_verification_code.php | 96 ++ .../list_notification_channel_descriptors.php | 86 ++ .../list_notification_channels.php | 88 ++ ...notification_channel_verification_code.php | 73 + .../update_notification_channel.php | 65 + .../verify_notification_channel.php | 85 ++ .../QueryServiceClient/query_time_series.php | 87 ++ .../create_service.php | 76 ++ .../create_service_level_objective.php | 75 ++ .../delete_service.php | 71 + .../delete_service_level_objective.php | 76 ++ .../get_service.php | 73 + .../get_service_level_objective.php | 78 ++ .../list_service_level_objectives.php | 80 ++ .../list_services.php | 80 ++ .../update_service.php | 59 + .../update_service_level_objective.php | 59 + .../V3/SnoozeServiceClient/create_snooze.php | 89 ++ .../V3/SnoozeServiceClient/get_snooze.php | 73 + .../V3/SnoozeServiceClient/list_snoozes.php | 81 ++ .../V3/SnoozeServiceClient/update_snooze.php | 83 ++ .../create_uptime_check_config.php | 76 ++ .../delete_uptime_check_config.php | 76 ++ .../get_uptime_check_config.php | 76 ++ .../list_uptime_check_configs.php | 80 ++ .../list_uptime_check_ips.php | 62 + .../update_uptime_check_config.php | 62 + .../v3/src/V3/AlertPolicyServiceClient.php | 34 + .../V3/Client/AlertPolicyServiceClient.php | 511 +++++++ .../v3/src/V3/Client/GroupServiceClient.php | 448 +++++++ .../v3/src/V3/Client/MetricServiceClient.php | 679 ++++++++++ .../NotificationChannelServiceClient.php | 683 ++++++++++ .../v3/src/V3/Client/QueryServiceClient.php | 202 +++ .../Client/ServiceMonitoringServiceClient.php | 639 +++++++++ .../v3/src/V3/Client/SnoozeServiceClient.php | 438 ++++++ .../V3/Client/UptimeCheckServiceClient.php | 475 +++++++ .../Gapic/AlertPolicyServiceGapicClient.php | 806 +++++++++++ .../src/V3/Gapic/GroupServiceGapicClient.php | 752 +++++++++++ .../src/V3/Gapic/MetricServiceGapicClient.php | 1178 +++++++++++++++++ .../NotificationChannelServiceGapicClient.php | 1075 +++++++++++++++ .../src/V3/Gapic/QueryServiceGapicClient.php | 261 ++++ .../ServiceMonitoringServiceGapicClient.php | 1044 +++++++++++++++ .../src/V3/Gapic/SnoozeServiceGapicClient.php | 680 ++++++++++ .../Gapic/UptimeCheckServiceGapicClient.php | 724 ++++++++++ .../v3/src/V3/GroupServiceClient.php | 34 + .../v3/src/V3/MetricServiceClient.php | 34 + .../V3/NotificationChannelServiceClient.php | 34 + .../v3/src/V3/QueryServiceClient.php | 34 + .../src/V3/ServiceMonitoringServiceClient.php | 34 + .../v3/src/V3/SnoozeServiceClient.php | 34 + .../v3/src/V3/UptimeCheckServiceClient.php | 34 + .../Monitoring/v3/src/V3/gapic_metadata.json | 336 +++++ .../alert_policy_service_client_config.json | 69 + ...alert_policy_service_descriptor_config.php | 107 ++ ...lert_policy_service_rest_client_config.php | 87 ++ .../group_service_client_config.json | 86 ++ .../group_service_descriptor_config.php | 123 ++ .../group_service_rest_client_config.php | 98 ++ .../metric_service_client_config.json | 101 ++ .../metric_service_descriptor_config.php | 174 +++ .../metric_service_rest_client_config.php | 156 +++ ...ication_channel_service_client_config.json | 94 ++ ...tion_channel_service_descriptor_config.php | 175 +++ ...ion_channel_service_rest_client_config.php | 145 ++ .../query_service_client_config.json | 27 + .../query_service_descriptor_config.php | 48 + .../query_service_rest_client_config.php | 41 + ...vice_monitoring_service_client_config.json | 94 ++ ...e_monitoring_service_descriptor_config.php | 176 +++ ..._monitoring_service_rest_client_config.php | 145 ++ .../snooze_service_client_config.json | 64 + .../snooze_service_descriptor_config.php | 94 ++ .../snooze_service_rest_client_config.php | 79 ++ .../uptime_check_service_client_config.json | 74 ++ ...uptime_check_service_descriptor_config.php | 116 ++ ...ptime_check_service_rest_client_config.php | 91 ++ .../Unit/V3/AlertPolicyServiceClientTest.php | 380 ++++++ .../Client/AlertPolicyServiceClientTest.php | 442 +++++++ .../Unit/V3/Client/GroupServiceClientTest.php | 541 ++++++++ .../V3/Client/MetricServiceClientTest.php | 769 +++++++++++ .../NotificationChannelServiceClientTest.php | 809 +++++++++++ .../Unit/V3/Client/QueryServiceClientTest.php | 182 +++ .../ServiceMonitoringServiceClientTest.php | 790 +++++++++++ .../V3/Client/SnoozeServiceClientTest.php | 416 ++++++ .../Client/UptimeCheckServiceClientTest.php | 517 ++++++++ .../tests/Unit/V3/GroupServiceClientTest.php | 468 +++++++ .../tests/Unit/V3/MetricServiceClientTest.php | 672 ++++++++++ .../NotificationChannelServiceClientTest.php | 716 ++++++++++ .../tests/Unit/V3/QueryServiceClientTest.php | 134 ++ .../V3/ServiceMonitoringServiceClientTest.php | 701 ++++++++++ .../tests/Unit/V3/SnoozeServiceClientTest.php | 351 +++++ .../Unit/V3/UptimeCheckServiceClientTest.php | 450 +++++++ 305 files changed, 55881 insertions(+) create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Alert.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/AlertService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Common.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/DroppedLabels.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Group.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/GroupService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Metric.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/MetricService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/MutationRecord.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Notification.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/NotificationService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/QueryService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Service.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/ServiceService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Snooze.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SnoozeService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SpanContext.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Uptime.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/UptimeService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Aligner.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Reducer.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationChannelStrategy.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationPrompt.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationRateLimit.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/EvaluationMissingData.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/LogMatch.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricAbsence.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold/ForecastOptions.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MonitoringQueryLanguageCondition.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/PrometheusQueryLanguageCondition.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/BooleanTest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Daily.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Hourly.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Minutes.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/RowCountTest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/Trigger.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/ConditionCombinerType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation/Link.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Severity.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/AvailabilityCriteria.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/LatencyCriteria.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ComparisonType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateAlertPolicyRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateGroupRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateMetricDescriptorRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateNotificationChannelRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceLevelObjectiveRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateSnoozeRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesError.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary/Error.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateUptimeCheckConfigRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteAlertPolicyRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteGroupRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteMetricDescriptorRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteNotificationChannelRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceLevelObjectiveRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteUptimeCheckConfigRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DistributionCut.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DroppedLabels.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetAlertPolicyRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetGroupRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMetricDescriptorRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMonitoredResourceDescriptorRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelDescriptorRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceLevelObjectiveRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetSnoozeRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetUptimeCheckConfigRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Group.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GroupResourceType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker/State.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/LabelValue.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest/TimeSeriesView.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/MutationRecord.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel/VerificationStatus.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannelDescriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Point.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryError.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryErrorList.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesResponse.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Range.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/RequestBasedSli.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SendNotificationChannelVerificationCodeRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/AppEngine.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/BasicService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudEndpoints.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudRun.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/ClusterIstio.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Custom.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeNamespace.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeWorkload.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/IstioCanonicalService.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/MeshIstio.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Telemetry.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelIndicator.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective/View.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceTier.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze/Criteria.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SpanContext.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget/CloudFunctionV2Target.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator/Position.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeInterval.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeries.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData/PointData.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor/ValueDescriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesRatio.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TypedValue.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateAlertPolicyRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateGroupRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateNotificationChannelRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceLevelObjectiveRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateSnoozeRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateUptimeCheckConfigRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/CheckerType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/ContentMatcherOption.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher/JsonPathMatcherOption.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/BasicAuthentication.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ContentType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/RequestMethod.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode/StatusClass.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication/ServiceAgentAuthenticationType.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/PingConfig.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ResourceGroup.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/TcpCheck.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckIp.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckRegion.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/VerifyNotificationChannelRequest.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/MetricRange.php create mode 100644 owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/PerformanceThreshold.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/create_alert_policy.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/delete_alert_policy.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/get_alert_policy.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/list_alert_policies.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/update_alert_policy.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/create_group.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/delete_group.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/get_group.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_group_members.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_groups.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/update_group.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_metric_descriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_service_time_series.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_time_series.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/delete_metric_descriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_metric_descriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_monitored_resource_descriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_metric_descriptors.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_monitored_resource_descriptors.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_time_series.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/create_notification_channel.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/delete_notification_channel.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_descriptor.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_verification_code.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channel_descriptors.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channels.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/send_notification_channel_verification_code.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/update_notification_channel.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/verify_notification_channel.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/QueryServiceClient/query_time_series.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service_level_objective.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service_level_objective.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service_level_objective.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_service_level_objectives.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_services.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service_level_objective.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/create_snooze.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/get_snooze.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/list_snoozes.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/update_snooze.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/create_uptime_check_config.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/delete_uptime_check_config.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/get_uptime_check_config.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_configs.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_ips.php create mode 100644 owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/update_uptime_check_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/AlertPolicyServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/AlertPolicyServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/GroupServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/MetricServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/NotificationChannelServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/QueryServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/ServiceMonitoringServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/SnoozeServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Client/UptimeCheckServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/AlertPolicyServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/GroupServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/MetricServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/NotificationChannelServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/QueryServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/ServiceMonitoringServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/SnoozeServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/Gapic/UptimeCheckServiceGapicClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/GroupServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/MetricServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/NotificationChannelServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/QueryServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/ServiceMonitoringServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/SnoozeServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/UptimeCheckServiceClient.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/gapic_metadata.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_client_config.json create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_descriptor_config.php create mode 100644 owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_rest_client_config.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/AlertPolicyServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/AlertPolicyServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/GroupServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/MetricServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/NotificationChannelServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/QueryServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/ServiceMonitoringServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/SnoozeServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/UptimeCheckServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/GroupServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/MetricServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/NotificationChannelServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/QueryServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/ServiceMonitoringServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/SnoozeServiceClientTest.php create mode 100644 owl-bot-staging/Monitoring/v3/tests/Unit/V3/UptimeCheckServiceClientTest.php diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Alert.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Alert.php new file mode 100644 index 0000000000000000000000000000000000000000..8553869e7c2d9615dcd8a0afc7c6a85c000ecbbc GIT binary patch literal 7280 zcmcgxTXP#p6<*1aFGs$mW52R!FjaJqX&8rf1LxhV1ydAiScy3hH}rMrLf z+&Z=3jIxOP1jUSU21r(7PTeS>{yyk?UW=HE7C!wCY6fi+HDkd zOwU$nR%)AOTc_!cX=tu#YeqZ$dMmAWJ0DS)agjw9umJiG%5|5;u`*Hp=I6&L@zt2wfUsx(E{-r~BSNi9WpC`w+O+wu(6 z)l5TT0u@80_a8_Clg+(rnYhnqQm~RkwsqWgy==JDHWa;Hq>gH97H;bhr)INl>h=uA zzTAJ{t7ULnOS&)Cn9W{T?%>d4Nzv@Hml(V$@wnp`4o}MbN zHPg;!`@8Ccj1sL<-(M3;4LGJ=Fgxhs$#o7&?|aO7rctG;X*VZF>A9rnAxjb95~43{ z#j>dFOfFir)cO%F*qcJ8*0pH8rgf;{!-S7FIvEd&4 z`Z0_RF0v-VFNMzW!!PxED|y2YO2yLBw(ofnjmg_X;}ydk5&S6+hfeAEK9p_lM1Srr ze=ZMo44!n;_tdEIH@-Xk@eN9?$UyKK2J(G;G=p3@ZjVfARm| zDqLYnCJ~V$_ZRXr|H;jhHCSwFj-@MInGZ$T5ZQ*Mrm1=zY6wCmmhf{tlTHb3gJw*H zRHTYwF~o^`4z*=nX;9rstV%P8@_0PTF$(Q*nUdk!UGf|go@q2OotcJ{SmZFDj)y4( zGNcUi=(~o7X*@BDds)tWK7}|&H5X;xbkj-@Yy7ojjl|I@F6#0-7sCPrKvo6W%X1s3}&!p-01>&1}myf#gJfC0yx&) z0BeBOslhbD#Ltm35uZYQ2bOu6k{y?oz;-vW&ZQ?H11H9jFGg}O@6gxOX12JF5X+f| z!`C0?(~&R1*cwUxH3Cb63|oOYWQL1G6|6>%FLW>rWEKz!!R9rXbG*i{sOlzWP%meG zgzQ30*NktR#1&4b&&IE1Kyzvjg~h5Kz!mn#g;?TYM&dBz*}7Ot^6xicq0h=iKOPs^ zsxF8#o-UBD;aZRSvU`eY>eSSme6#V))A5V$X-i>CVQXqFfY|+r9K&iKTWL7Vip*s3 z%oo!G=a{@oIqZ5LwxhV}DQ(KS*-or+>X#t8>##SEcJKpywZ92 z#4}H(+2heGJ+zvewoThSZ8?c~9%Q#ithhguB!M)kVRke_!G==ykr#L@ z6d(~E8&Cj~Dxk31GBJ%Rjw_p1P*E7^zZ$VR)?|wcn(CSGd^DxDeawo0Bu`k$>R5`c zIi`U*hUL2v`5McMKaUrf4Or>Lxs27rqlp-bN3inD2W9)B24zbS#iye=4xU_Ob}->JWI2%iwPvf3INs6~#r5+aV!ID3QwPD{`efx%X z{pz~}F~L|~d9%?ck>qz#koLzUSb}mqjr%bFe=Cy@FkJ-i|A6U#m;q^Ax+i476e64c zFckUYSjT%3@)WLx0+*kq&@sIK85cwm(t%mdr=U0b`7|sVw?V-!hm%UIbpycmbSk%P z)3bQ4^IJ3=5UnR0<|)q~_&(ggQwwXtWvrdp)v!FNVOqlT0Z(`H965>SAI@2!Z7fy) zJqwHBIyuxAM=*!Q$#W@-F&5N6oyIz0_|(3@!IJv|W>4{=NbmX{dVXolT@Hhg6^Jzz z4G|fA@9 zgvV%U)Wq^Zu23tVlvX2T6K;)~<Mz_;7ITH896lVwqj^+ zMdO@)7yk2dh{YD381ZT^{Z9P297^P2J`M}Lg(iO!gC%Z=-T}V_8w1xE?7BeKwT>pv z<`ZR#0mRfn=vJhPXnPEd{1Vm%^q{#rmMdDG@3ols!xWFFRsTjv4HirhA~V@|$-kHZ+}RA4+M zhi;2MR3JLLoB9l{+IU>U%d0NFH{cB=Lj%vRvDh_j9$vE=yq5(oyBOS}3i~Z2k=9gBvVN{cA_1lTx)@ z`^7ofMVK$(XWaK5VlP0fRIPIOILy7wRSysp^U^;e?{j~P!1qGD9-Ws++D}50rX%u2 zIMJX~_|Fe#4Dx8I1Vb>B;64(VNr#4N9(WWWDO~d~@^ub_&}#-WS^908;b%0=%J`D@ zIurV4HJinternalAddGeneratedFile( + ' +ƒ +(google/monitoring/v3/alert_service.protogoogle.monitoring.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto google/monitoring/v3/alert.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"• +CreateAlertPolicyRequest; +name ( B-àAúA\'%monitoring.googleapis.com/AlertPolicy< + alert_policy ( 2!.google.monitoring.v3.AlertPolicyBàA"T +GetAlertPolicyRequest; +name ( B-àAúA\' +%monitoring.googleapis.com/AlertPolicy"´ +ListAlertPoliciesRequest; +name ( B-àAúA\'%monitoring.googleapis.com/AlertPolicy +filter ( BàA +order_by ( BàA + page_size (BàA + +page_token ( BàA"ƒ +ListAlertPoliciesResponse9 +alert_policies ( 2!.google.monitoring.v3.AlertPolicy +next_page_token (  + +total_size ("Ž +UpdateAlertPolicyRequest4 + update_mask ( 2.google.protobuf.FieldMaskBàA< + alert_policy ( 2!.google.monitoring.v3.AlertPolicyBàA"W +DeleteAlertPolicyRequest; +name ( B-àAúA\' +%monitoring.googleapis.com/AlertPolicy2ž +AlertPolicyService¨ +ListAlertPolicies..google.monitoring.v3.ListAlertPoliciesRequest/.google.monitoring.v3.ListAlertPoliciesResponse"2ÚAname‚Óä“%#/v3/{name=projects/*}/alertPolicies– +GetAlertPolicy+.google.monitoring.v3.GetAlertPolicyRequest!.google.monitoring.v3.AlertPolicy"4ÚAname‚Óä“\'%/v3/{name=projects/*/alertPolicies/*}µ +CreateAlertPolicy..google.monitoring.v3.CreateAlertPolicyRequest!.google.monitoring.v3.AlertPolicy"MÚAname,alert_policy‚Óä“3"#/v3/{name=projects/*}/alertPolicies: alert_policy‘ +DeleteAlertPolicy..google.monitoring.v3.DeleteAlertPolicyRequest.google.protobuf.Empty"4ÚAname‚Óä“\'*%/v3/{name=projects/*/alertPolicies/*}Ë +UpdateAlertPolicy..google.monitoring.v3.UpdateAlertPolicyRequest!.google.monitoring.v3.AlertPolicy"cÚAupdate_mask,alert_policy‚Óä“B22/v3/{alert_policy.name=projects/*/alertPolicies/*}: alert_policy©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBÌ +com.google.monitoring.v3BAlertServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Common.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Common.php new file mode 100644 index 0000000000000000000000000000000000000000..0fef40d6d1092c1e0a0c14353880a477bd27cd54 GIT binary patch literal 2539 zcmbVOYirw97>?~+k8@GfwDrO+r&*y+>68*Lg(}O2VxKqyTlQqdlwlCEbnFTgN$3*D zMt;Hm!(jVZ*oXa%!T!j8#a`VkId!|Sd~we6-k6FJ)$C+C6=-RQ(!0}9b zdUVq`0y6-(*c(E&c1?X((`M+QAxr}aae_>6R)x(-x& zhO<=qQSngtNVEg$*_t(KQD65=7YgfxD$h@8FrzF&>W69A$elUC^(050e=o^19C#ru zM#tErLFn11ao&-GyV-xE1w;w1Ick}H;F;qvs)^_GqH-ULEN6AKLTL8?GgVCJVW3^R zi^IlLe)X-H5+@kOjHe5jpZct_sLp5T*KPFVUk8WXOH{agwz!+d{^zM-JY3MNBO|RU z8Mpl}?#qKL^+e&|T?rxO)}_W!vqH-5AvA_osyET8R>GzF`sEV)5LKa=S6`=a8Q==Q zkI<&!z&O$ruK-?3@TfEPG{u(z-vIm-VvR!2Qt1jvtH(7itxt1JuGrbjrSmnk66bSZ zq0NZ;cp?E|U!Zkr8){TjElR3-yq~$r2;pYEVmXAMXQ4t}nnwJh2; zLPAGuORCh92(!fQ01@%IMLLSWl-QYqEGUF2!+`823ZkSCx!>zVa0RA`N&S#FirVY6 zh|DarTWBLeyQ0LP!clm`RCCu|B1p_;9=qAQk`!hu*B@MUnQfLqn~Ar9(rS?*vy(@S zEmTFmA`FwKn4lLzXF!-5@bMrqzmSEdBKD+2e>WHOiQFWTB6f)S`ZdEY7Mw5-779*Y zGJ6XJFHe|w8c%+4E3G0XFYJBq6lmi+sWeST;VmXvCVyK5&Qb5c&s!D&vv> literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/DroppedLabels.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/DroppedLabels.php new file mode 100644 index 000000000000..f7e45d86002a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/DroppedLabels.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile( + ' +— +)google/monitoring/v3/dropped_labels.protogoogle.monitoring.v3"| + DroppedLabels= +label ( 2..google.monitoring.v3.DroppedLabels.LabelEntry, + +LabelEntry +key (  +value ( :8BÍ +com.google.monitoring.v3BDroppedLabelsProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Group.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Group.php new file mode 100644 index 000000000000..999b703bd1a3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Group.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile( + ' +‹ + google/monitoring/v3/group.protogoogle.monitoring.v3"€ +Group +name (  + display_name (  + parent_name (  +filter (  + +is_cluster (:™êA• +monitoring.googleapis.com/Group!projects/{project}/groups/{group}+organizations/{organization}/groups/{group}folders/{folder}/groups/{group}*BÅ +com.google.monitoring.v3B +GroupProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/GroupService.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/GroupService.php new file mode 100644 index 0000000000000000000000000000000000000000..a03455b22eaefbdb97cd6bc07b10a02c337b4ce1 GIT binary patch literal 3723 zcmb_fL2nyH6vj@IIuoE|)DqXF?Zi!q8-E@PSnn>o zV~0?M12+UhLcQ=4fd9Z9Rh;0K69-QG1Wvq}on5aTJGLcqakTT^oA15%y>DjTe%EVx z=nkn+hx!Jiby7PatVN0EyUaCRo76gu2K9;Qwmr+HzCy_EK6!utkUZFZe7Fp*f!py- zs*sLyN<8*DRCt^Z!Z7G5BJk&RYPMyPfEf&aR;-|E!OoUpTVFyN+oWOG0fhkP zZ5tiOWR~j??y&Eev~Z7vF}dxE=R(@sBm#86D*;u|A3Kctj$!M&G%$V3gDelgR8^al z#r5M~3isr;Je<`ag%G2vo&&i}nBSqv-3jq2>-f%=z|8}k#{cO<%B6Xht~rj&tKd3; zs`hf~g&5_yV_Vc=)A>BKs9i79meI9be>zv$T3UZXC26KYJH1yQm-HRC4dk30a=*7= z;N;FRYoKQj+8#R@?kdQ(@s1^_rPb>(lODpj72@7=Caj`wuc5-EbB3>mmI@>-CsOH_ za!blio-i6%T9!*aJX|3_Sm1;7 zzCc8z#SIxmNC`}3k@Dh(i}~NuXz@KOV4_#S6Z(0F1`OXvm$>3&FOyVZzO1kQrKSJX zmhtT#4kZi zjG3uo?4ql65FF~%4TmM7T$(D%BAWM%Cangbj@emooy8a-@rk*gQ71bm!e!80!?Ho= z@*g3bEM?$Tv($h-1wFkqx3k?i_fU7F<;%jADep{2O{d$e7n{+MwZ z+bX_IkAWQHAOl6S@XHYc1xx4gnqY3Xv*^&$;}DAHEeUaH=w}Zr_e%TVDX476DAX(cZ*Zof?Alu6AciSH+QRKTxa%%h^5;M~ut=i2oI zqW+Wo5AB;&i!m=yi^b#PV+kof=Zy|)!6nG;)HgiaU=7!Aua7hD?KOp|0!LK6{Cf&z z;d(K&Fy+OhYKYt8LF!{ofQuaX)uibrUs#X{%zAe-@y)Ak^&on+U(&gXcvvYrJkLnp z;CZGTm7Yh7x-M4rU;czDug=QK>d3cvf1Cuc_2%`z6PLB8 zzUM?fcf3jawA-Gth&z@hy#aXUl!bw5F?!hV9kIx?&B!zkCD1sU0gaRHE`a5lVMx&m z9l*~(@h^x+u4B4ZZEgE^+_{DhhB(Xr`<454q@j$_Y?9N(h?aO_#Eb&D#W z!uDq1Bhx*arqUPWk+|{5ix~Gz*EnFI#hn0&_0d$4|&2`^>1TwSey(DqD-0|l=?n0A-AC{37wj5y+8}CYNx3!N=X|yQzqLC zElC?n_z|;uQ9|ev$XUSb6Jgiv^ldqtRPUWoDH)LKPzZHOSq%pY%Rh7-~rQ_N4HN@6B#?BmAj(0X)Ns`~AJ<$QA z7{dtp)-Ox+CvOEyO$KO9K7;i@)FG^w=o*UuQHq=E2Tj##6E4SiE!4{xqC(z>s+~+b zUKsU?IBfn^gsn{HEMIa5uDW6thbhMAA&Ng2Q;07IHi!EWuF3@Ga4J`QajuKPYm#y1 zw((m5uDo_es<8Hwoym@vs!0WQU7N>Q<+62E6rbuP|H!mhXA$QR9ecir!p=X z0x77ZN_qf^mgoh0T8OV*C?eXb`XAu8#w)1EW)T07FJXO^6hx<~IV5-Cy$Ht;-y?i5 z5SvWa3Nzn)4v^!r1u(+*WGLgynw1}3A|F5%J>R*V9E-B8;qf)t4DosNCds*&u*$ry*&u9@Oyd4mYd8VW(ag-zz!nFqnE+IbfbccJF75cip3 z%2;$=wX*`_YYHk<<;)C`KuO5jXhC_FAhxpWcuZ0*5tINorFg2SmU@2_ppLJ?Lc+bO zx`yS7(JwsTw_HEAQ&U8>Cw_j1!n*_4sMAjFEEw%(w^%Uxz1TRE8VptNWxWZ|}?g4v`(#_HD!N$lJYEi@363cOA1s+_EgM z-IL$A_fTG6d;Q@>Q1$GdYYHjfO|uUDF_CW)&ez z?-I|^4I*#cU)dzS-qd})zQGLCH$wyUN3|t{jE?SkGDv};2iy)iKr;MudfOe-kUd}b z;lInK*DzskQ}39MA&_OcrFT367W!pdJ9^I!{ z01oxnEuXlS-l?w<&u~o#;=B){s@f)gh#-Bkuqd{r=FFD7z zzvo&@%x`MoF#J`|z)N$?x@K86MZvZ_RgGebObk+7?U=;!N7K1ul1_7l?C86u?T)6( zvpAv-=L2bO5ka+)A{<>SLBRT|-33aY+~uV9r~!vmgG8@)9e@Ai8*e#A{Q;1mH-G|+ z)z@yBg2P&~8B+ERRQ5thGD^95^i3Hpp17p(^IWtHP>Jd<@7Ctd2?M%gRt&~8-T~%b ziY>G#of_MMPeLHB*=40K7B0m!#b%`0a0NAl(D|59YU!d_iX5eF3c4FS5Zc)y2`^p{ zR#-oS&QKvVS1I3J$EeV{?|FPd`KyHL^LI_p-%L|F>L=b7`E`$YKK=z7qiwPy^R($`GS?8cnp!4m7Vqj+(=#(UhaNNyCFqSvUoc#xX{S zJ@W1MiB%Y*V#@C%v~aw?o&#-%;C1wTfOVr8_D8QE$)^_b)%v{fw+s%KhxvLAJ!g>* z{6@?h=CtCYD;s1Oc4_EnU?Ftq>7Y~oETI<}28@LniMpLgRFx&Fgo{HGm9m7-B(t+} z>MKpcvwbPz&(HPei7hBDx-h^`k)WR<%t@S)o);6@Njo?&CBH&*G$kqdAP)gDJP!gH zGy*cpM-sZQ>Jk`CM%rT}^lzfmeXy`H$ybM>LQ&5tI=Zk%I%Gr#M*`trr_foN*@tGA zzyM^Dut%tZdWaFd#HjZ&zC4(Ek%=tQ6s#db{nCHXB1&+saojW@~GaAij;xdc?4;rta=H;ui7{)QK$2ph??p61TCvUzngs z;7v5PYm&XfGw|1RRn2xH6H*o!2l)|L;GreDnQI7wsc~KM2qGrXGaiih6hzBE}dydZ1>}_fWWe&E*X;s<@p*LGhe^ECaBL`~hGF+CACgEZ^8z~K^$de}USg4+ zZR2>!C>2^3=~7{>N~JLV7hvq$OjN=V&_$XmS4VF%!Vg& zJ36QFEi{v`1+SWgDaN(S$65i|tkPmZ;3ArKbeFzw28ER$R9GzFchEG8m*t3-KYk_5 zIvAij?Z(|e?Etv4_dNck5}@ zd6pIJNMkeZZ@&Ec54j)XDxJg+=+L_ib2V)dUZr>#Tqs2Ee^G8d{Dp*mG<+z;OW9ry z*9t;B@z|=Y#e;!CJu8@@u~dr1L;QD%pY`c+$HUd^Fj%fq^H(q*%nj%w19U`IUX2H` zi0kuNkw99~o8pfpbS7gO#IIy~o*^2bK6LIpTWVKJx}5RSY=C} z%+X&SX|t5hrM~%+G5#h@3|YQsV5|0zs1)wm?9p>jEZNdQEVDtHf|uGdyMRc+T^t4O z|4V3^k}c}X_-e3A@?c9!1um6NCM<~id+A6!&+z8&x}{*0Ezx0+L2h9=8*zF<@UidR z`aHf83E6I2x6H@bL&W( zVd2vK#K6d+yrLW%r79KiC*d3;4vmK)2;Y~BcL%vxQ_2x^@opbsryA_VPxuB7&mBph zYv*IUNnU{bTlePGw4qQUPczVt0=zhy~yQSmAqrFBDErZ+5 zQRMer(u3{3QipEFhKkEed%3|g%fDdJD|2595M9%9b$(Qb+;OO=4>xT zK{?xh$<1xBTlexRMW(zNUEe*beI6{<>uj|iznX`;`6syxTv=7wx~fL%stW7c|D;h~ zbn#M1gah#_qZL*T`nu^dJvrBtm3k2Wa|AOtf;v9nKSofMin8=X`&;fQZ<_GEtni17 zZ-7Lw8eV|LM&(2NP8internalAddGeneratedFile( + ' +ò +*google/monitoring/v3/mutation_record.protogoogle.monitoring.v3"U +MutationRecord/ + mutate_time ( 2.google.protobuf.Timestamp + +mutated_by ( BÎ +com.google.monitoring.v3BMutationRecordProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Notification.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Notification.php new file mode 100644 index 0000000000000000000000000000000000000000..247b22413b13dd8762fee1d3312bc23d6c75c015 GIT binary patch literal 2943 zcmbVO-A?016s`jc?1Y6~vufQ`v;&JomR%AxQPtM`R0#x%R6+zHtFA0X6MGV-H6Ckh zr(#jwq!+#EO<$qv3silGUh@dOsCqnh5(h#zySa*I&iBpCcg}Zaw!d*NT=WbdQilrS zQwz7Quzx|ZE4a^1ZsS(aZc~9xe(5rsiX6uKC%Af2$Cdq~`U*fj9te}_xWjqJruj?m zFrN$Nbn@L|-r+uLGn4p?J2}aTkV7u1=Mt0R!&>>6`otnWF%Bi%I3B=_MsW)v(ZRc#U~Y1`9J{vo~;x9o#0iM}gpOY&&qwa6dQ%oH!=UKF1Mf z7`x_jIQ0(hZ>Sau0U{Vjj!%U{Y-68#reH1{vIe2L-l6_LzHlV_JYF`WV{M#`_NeQ3 zHo1d+5zyr77z^qL!r7Ah4hedLf5sTON-i@F7`3f3y&zr2g{}`zH6*zY`W?cTTCvg*7?LApNfdaa}6B@laVc zo4YKok&_R1`e zjEA{uLj84UJpFNETErQNr&i*r;X0v%!T2x`hir@uxs0`K3Mp z&-<|`8>_$1qNOn++^UBs$yzB-{au<6{Q1@ie_AHbCT=p$+^w}EDJK``yMTIsTf?Kp^^Q-(;mv2+Mb-ZksyK2 z4IJtVG)o=QvZJC~o1(mfCdt95BptU||RHxBqtL~!5 zw_1d!J(Ai?gwJfEbW)Wxn);Dm#eLurde9B`sL2MPr@m4$pQFXwLcRsE`UN~pPx0)t7o;!9t>CZAAg`OAaq`h!r)thvYZ=yrSyN5o6Vyx}4YbAzarR#ny~8NO65|rN4|`afwG?=u>8ndGN`|=vmf7J%s)P Dx_sV8 literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/NotificationService.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/NotificationService.php new file mode 100644 index 000000000000..b7607591fe99 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/NotificationService.php @@ -0,0 +1,97 @@ +internalAddGeneratedFile( + ' +Õ% +/google/monitoring/v3/notification_service.protogoogle.monitoring.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto\'google/monitoring/v3/notification.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"¡ +)ListNotificationChannelDescriptorsRequestM +name ( B?àAúA97monitoring.googleapis.com/NotificationChannelDescriptor + page_size ( + +page_token ( "— +*ListNotificationChannelDescriptorsResponseP +channel_descriptors ( 23.google.monitoring.v3.NotificationChannelDescriptor +next_page_token ( "x +\'GetNotificationChannelDescriptorRequestM +name ( B?àAúA9 +7monitoring.googleapis.com/NotificationChannelDescriptor"µ + CreateNotificationChannelRequestC +name ( B5àAúA/-monitoring.googleapis.com/NotificationChannelL +notification_channel ( 2).google.monitoring.v3.NotificationChannelBàA"à +ListNotificationChannelsRequestC +name ( B5àAúA/-monitoring.googleapis.com/NotificationChannel +filter ( BàA +order_by ( BàA + page_size (BàA + +page_token ( BàA"™ + ListNotificationChannelsResponseH +notification_channels ( 2).google.monitoring.v3.NotificationChannel +next_page_token (  + +total_size ("d +GetNotificationChannelRequestC +name ( B5àAúA/ +-monitoring.googleapis.com/NotificationChannel"¦ + UpdateNotificationChannelRequest4 + update_mask ( 2.google.protobuf.FieldMaskBàAL +notification_channel ( 2).google.monitoring.v3.NotificationChannelBàA"v + DeleteNotificationChannelRequestC +name ( B5àAúA/ +-monitoring.googleapis.com/NotificationChannel +force ("u +.SendNotificationChannelVerificationCodeRequestC +name ( B5àAúA/ +-monitoring.googleapis.com/NotificationChannel"¥ +-GetNotificationChannelVerificationCodeRequestC +name ( B5àAúA/ +-monitoring.googleapis.com/NotificationChannel/ + expire_time ( 2.google.protobuf.Timestamp"o +.GetNotificationChannelVerificationCodeResponse +code ( / + expire_time ( 2.google.protobuf.Timestamp"z + VerifyNotificationChannelRequestC +name ( B5àAúA/ +-monitoring.googleapis.com/NotificationChannel +code ( BàA2ê +NotificationChannelServiceì +"ListNotificationChannelDescriptors?.google.monitoring.v3.ListNotificationChannelDescriptorsRequest@.google.monitoring.v3.ListNotificationChannelDescriptorsResponse"CÚAname‚Óä“64/v3/{name=projects/*}/notificationChannelDescriptorsÝ + GetNotificationChannelDescriptor=.google.monitoring.v3.GetNotificationChannelDescriptorRequest3.google.monitoring.v3.NotificationChannelDescriptor"EÚAname‚Óä“86/v3/{name=projects/*/notificationChannelDescriptors/*}Ä +ListNotificationChannels5.google.monitoring.v3.ListNotificationChannelsRequest6.google.monitoring.v3.ListNotificationChannelsResponse"9ÚAname‚Óä“,*/v3/{name=projects/*}/notificationChannelsµ +GetNotificationChannel3.google.monitoring.v3.GetNotificationChannelRequest).google.monitoring.v3.NotificationChannel";ÚAname‚Óä“.,/v3/{name=projects/*/notificationChannels/*}ä +CreateNotificationChannel6.google.monitoring.v3.CreateNotificationChannelRequest).google.monitoring.v3.NotificationChannel"dÚAname,notification_channel‚Óä“B"*/v3/{name=projects/*}/notificationChannels:notification_channelƒ +UpdateNotificationChannel6.google.monitoring.v3.UpdateNotificationChannelRequest).google.monitoring.v3.NotificationChannel"‚ÚA update_mask,notification_channel‚Óä“Y2A/v3/{notification_channel.name=projects/*/notificationChannels/*}:notification_channel® +DeleteNotificationChannel6.google.monitoring.v3.DeleteNotificationChannelRequest.google.protobuf.Empty"AÚA +name,force‚Óä“.*,/v3/{name=projects/*/notificationChannels/*}Ü +\'SendNotificationChannelVerificationCodeD.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest.google.protobuf.Empty"SÚAname‚Óä“F"A/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode:*‡ +&GetNotificationChannelVerificationCodeC.google.monitoring.v3.GetNotificationChannelVerificationCodeRequestD.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse"RÚAname‚Óä“E"@/v3/{name=projects/*/notificationChannels/*}:getVerificationCode:*Ê +VerifyNotificationChannel6.google.monitoring.v3.VerifyNotificationChannelRequest).google.monitoring.v3.NotificationChannel"JÚA name,code‚Óä“8"3/v3/{name=projects/*/notificationChannels/*}:verify:*©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBÓ +com.google.monitoring.v3BNotificationServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/QueryService.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/QueryService.php new file mode 100644 index 000000000000..27959d462165 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/QueryService.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' +¿ +(google/monitoring/v3/query_service.protogoogle.monitoring.v3google/api/client.proto)google/monitoring/v3/metric_service.proto2á + QueryService¤ +QueryTimeSeries,.google.monitoring.v3.QueryTimeSeriesRequest-.google.monitoring.v3.QueryTimeSeriesResponse"4ˆ‚Óä“+"&/v3/{name=projects/*}/timeSeries:query:*©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBÌ +com.google.monitoring.v3BQueryServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Service.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..ffa79a3a9746c27bd7d886c8dec772ecbf848b0b GIT binary patch literal 5715 zcmcIo-EJGl753`S;-MtcYuTph)>zR_EV~Zbh(QogQ4Erj6{3>O$g&&+1UAdv5jFL4 zce_7y6hl{ih2Hh5=tY5|7wt_Sp%+1K3giKD?WgFOpCy+RMbQD`8;d*heRIy4@0>X^ zpFi=s)Z*+^L#gSP1n}i(eW|yHPh{S)FysW)3%>$&z>J@JKK%J zHG~Fk6CiqQb7D3HA#`v0XRmN1fF3MZMRw5C!t{(q0!pq z$ku)z**Yq30+_ZD1lkM10B=FVe_qtKsi_5_5#oRMX`oYFjv6-o9&O*!jtx5?h&?~| zIC9L8x{k&G&mEJjKhy*#n|t4L(bp|4wx!A3N7q{oCnUaO*sX06m_GH;wI)ujR5~Q= z2aSDMe<+t_bo5wT7dBQZ=ZxIaLO&wO)iup0VdOiT+-^p2*8i(DCQ?<8ww_XATQzcG z^r-7sDg&0R%X>L!^&kj$HU1+Ajc~SK#C`jW)yKi zu5pI-OBn`HsKRpF2&mboxIT>|H3pF+Y6Vguu}PPN{%LNR!!J|oVLV^0K{`U~b=znY zJIJkQvzRC!O?KcV0`~a)9S7IUFT#Szo%~%$^%DW}G}U#j$R;|qM6%}BU}ae3Y6h+% z8#~bClnyM_h32_%)GRF8uE{H;n8A`g&Wc2`--c_FD4~j3j7Ew9l0&&U_BH+$c28TPk_)zaDX&~pJ7QN0N(Ec`tEMAa2>{f7eSM3Ves3#n^xJ9ItWCOu;7ri)T^ zZEUA>c8uia`OaT7h3keL3aR{C0JQdn(BLm;?5GC0effVWur!p*iD}#ov70YpB^I#E z(;1$pTa)uN$sC_@$-MmpROxr(tD1({*W^^@+A_@d3_Bt@E~3iJXG*>RsX_U;0n71W zFEqdn&VLMfn z9+{?3VFzeR-Gf`wYAI&wSa{B2Uz}s9mfrZy#C_gl%Qj+&x&(6_*RXl1P}DN4u(ZIt zgKVgHW~4W6$CPnXR*d^lJk>tM24=Vo;~mt>#+?|Δ}K@ry+K1`OlNH=3lVrP5h zz8;5SRvb~y&k$1K6PP=q>``OqmHzVCi{?(f@wBnCoxP$i!rarBdwba#jML)I z*Uh~~y>XaTDnHD;tNv#O5_c_W_Ne@LvMYL)x$#@abkzfH<@3iZDK z3Wrn3{ry>$N19T@hCp=hg&&pS>=?+j3@O?8*pzEEy>WNEQbZZEDGKZhR&M?fks#C& zOhj9e-uPfV@IXvOJh5KH_&1nb?wdg3Sy{Uf|4K|9;A;yo$CO|A_Y5q?W~nQ%fW6m= zYvEO47SlP|u`Kd0*yQxEu;3*RJ9swbcd%si42s2^+B7`n)iu3wK_eY6RIDZ-b)Vw3 zfEpN-DqOYkoxw3rWw|Jh4@aM8Ps|=rmSJBKc2@i4IT&<*kW!SBl) zdg0a`(k?sGDG3f({pV52;uSIUX**)KZQYDQY5oQ3*-p%^N8y)On5@M{7fv8EvVwXC zu5%OPN`6djbXhcPY97?KVZ}YZF2_WV@+(*sZjB&$ds6rYG9!ktm4-YSTImtY`z*k+ z%=ZiSaPj4PQ266KWJWZuYH*Xg!OUeh3cQ<Ilo3;EH#&&p@_;zvZ z`dtH`jt*l@;R;{Ds$9BD3internalAddGeneratedFile( + ' +ó +*google/monitoring/v3/service_service.protogoogle.monitoring.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto"google/monitoring/v3/service.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"š +CreateServiceRequest9 +parent ( B)àAúA#!monitoring.googleapis.com/Service + +service_id ( 3 +service ( 2.google.monitoring.v3.ServiceBàA"L +GetServiceRequest7 +name ( B)àAúA# +!monitoring.googleapis.com/Service"‡ +ListServicesRequest9 +parent ( B)àAúA#!monitoring.googleapis.com/Service +filter (  + page_size ( + +page_token ( "` +ListServicesResponse/ +services ( 2.google.monitoring.v3.Service +next_page_token ( "| +UpdateServiceRequest3 +service ( 2.google.monitoring.v3.ServiceBàA/ + update_mask ( 2.google.protobuf.FieldMask"O +DeleteServiceRequest7 +name ( B)àAúA# +!monitoring.googleapis.com/Service"Ö +"CreateServiceLevelObjectiveRequest9 +parent ( B)àAúA# +!monitoring.googleapis.com/Service" +service_level_objective_id ( Q +service_level_objective ( 2+.google.monitoring.v3.ServiceLevelObjectiveBàA"¨ +GetServiceLevelObjectiveRequestE +name ( B7àAúA1 +/monitoring.googleapis.com/ServiceLevelObjective> +view (20.google.monitoring.v3.ServiceLevelObjective.View"Õ +!ListServiceLevelObjectivesRequest9 +parent ( B)àAúA# +!monitoring.googleapis.com/Service +filter (  + page_size ( + +page_token ( > +view (20.google.monitoring.v3.ServiceLevelObjective.View"Œ +"ListServiceLevelObjectivesResponseM +service_level_objectives ( 2+.google.monitoring.v3.ServiceLevelObjective +next_page_token ( "¨ +"UpdateServiceLevelObjectiveRequestQ +service_level_objective ( 2+.google.monitoring.v3.ServiceLevelObjectiveBàA/ + update_mask ( 2.google.protobuf.FieldMask"k +"DeleteServiceLevelObjectiveRequestE +name ( B7àAúA1 +/monitoring.googleapis.com/ServiceLevelObjective2ê +ServiceMonitoringService— + CreateService*.google.monitoring.v3.CreateServiceRequest.google.monitoring.v3.Service";ÚAparent,service‚Óä“$"/v3/{parent=*/*}/services:service~ + +GetService\'.google.monitoring.v3.GetServiceRequest.google.monitoring.v3.Service"(ÚAname‚Óä“/v3/{name=*/*/services/*}‘ + ListServices).google.monitoring.v3.ListServicesRequest*.google.monitoring.v3.ListServicesResponse"*ÚAparent‚Óä“/v3/{parent=*/*}/services˜ + UpdateService*.google.monitoring.v3.UpdateServiceRequest.google.monitoring.v3.Service"<ÚAservice‚Óä“,2!/v3/{service.name=*/*/services/*}:service} + DeleteService*.google.monitoring.v3.DeleteServiceRequest.google.protobuf.Empty"(ÚAname‚Óä“*/v3/{name=*/*/services/*}ú +CreateServiceLevelObjective8.google.monitoring.v3.CreateServiceLevelObjectiveRequest+.google.monitoring.v3.ServiceLevelObjective"tÚAparent,service_level_objective‚Óä“M"2/v3/{parent=*/*/services/*}/serviceLevelObjectives:service_level_objectiveÁ +GetServiceLevelObjective5.google.monitoring.v3.GetServiceLevelObjectiveRequest+.google.monitoring.v3.ServiceLevelObjective"AÚAname‚Óä“42/v3/{name=*/*/services/*/serviceLevelObjectives/*}Ô +ListServiceLevelObjectives7.google.monitoring.v3.ListServiceLevelObjectivesRequest8.google.monitoring.v3.ListServiceLevelObjectivesResponse"CÚAparent‚Óä“42/v3/{parent=*/*/services/*}/serviceLevelObjectivesŒ +UpdateServiceLevelObjective8.google.monitoring.v3.UpdateServiceLevelObjectiveRequest+.google.monitoring.v3.ServiceLevelObjective"…ÚAservice_level_objective‚Óä“e2J/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}:service_level_objective² +DeleteServiceLevelObjective8.google.monitoring.v3.DeleteServiceLevelObjectiveRequest.google.protobuf.Empty"AÚAname‚Óä“4*2/v3/{name=*/*/services/*/serviceLevelObjectives/*}©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBØ +com.google.monitoring.v3BServiceMonitoringServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Snooze.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Snooze.php new file mode 100644 index 000000000000..e98aca9ec3cc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Snooze.php @@ -0,0 +1,39 @@ +internalAddGeneratedFile( + ' + +!google/monitoring/v3/snooze.protogoogle.monitoring.v3google/api/resource.proto!google/monitoring/v3/common.proto"Å +Snooze +name ( BàA< +criteria ( 2%.google.monitoring.v3.Snooze.CriteriaBàA9 +interval ( 2".google.monitoring.v3.TimeIntervalBàA + display_name ( BàAH +Criteria< +policies ( B*úA\' +%monitoring.googleapis.com/AlertPolicy:JêAG + monitoring.googleapis.com/Snooze#projects/{project}/snoozes/{snooze}BÆ +com.google.monitoring.v3B SnoozeProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SnoozeService.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SnoozeService.php new file mode 100644 index 000000000000..c0b830a53194 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SnoozeService.php @@ -0,0 +1,56 @@ +internalAddGeneratedFile( + ' +• +)google/monitoring/v3/snooze_service.protogoogle.monitoring.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto!google/monitoring/v3/snooze.proto google/protobuf/field_mask.proto"‚ +CreateSnoozeRequest8 +parent ( B(àAúA" monitoring.googleapis.com/Snooze1 +snooze ( 2.google.monitoring.v3.SnoozeBàA"” +ListSnoozesRequest8 +parent ( B(àAúA" monitoring.googleapis.com/Snooze +filter ( BàA + page_size (BàA + +page_token ( BàA"] +ListSnoozesResponse- +snoozes ( 2.google.monitoring.v3.Snooze +next_page_token ( "J +GetSnoozeRequest6 +name ( B(àAúA" + monitoring.googleapis.com/Snooze"~ +UpdateSnoozeRequest1 +snooze ( 2.google.monitoring.v3.SnoozeBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA2˜ + SnoozeService˜ + CreateSnooze).google.monitoring.v3.CreateSnoozeRequest.google.monitoring.v3.Snooze"?ÚA parent,snooze‚Óä“)"/v3/{parent=projects/*}/snoozes:snooze” + ListSnoozes(.google.monitoring.v3.ListSnoozesRequest).google.monitoring.v3.ListSnoozesResponse"0ÚAparent‚Óä“!/v3/{parent=projects/*}/snoozes + GetSnooze&.google.monitoring.v3.GetSnoozeRequest.google.monitoring.v3.Snooze".ÚAname‚Óä“!/v3/{name=projects/*/snoozes/*}¤ + UpdateSnooze).google.monitoring.v3.UpdateSnoozeRequest.google.monitoring.v3.Snooze"KÚAsnooze,update_mask‚Óä“02&/v3/{snooze.name=projects/*/snoozes/*}:snooze©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBÍ +com.google.monitoring.v3BSnoozeServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SpanContext.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SpanContext.php new file mode 100644 index 000000000000..ed30a8928d94 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/SpanContext.php @@ -0,0 +1,29 @@ +internalAddGeneratedFile( + ' +· +\'google/monitoring/v3/span_context.protogoogle.monitoring.v3" + SpanContext + span_name ( BË +com.google.monitoring.v3BSpanContextProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Uptime.php b/owl-bot-staging/Monitoring/v3/proto/src/GPBMetadata/Google/Monitoring/V3/Uptime.php new file mode 100644 index 0000000000000000000000000000000000000000..a09b147fe5dc5016fc01c2029ec74f2467b392e8 GIT binary patch literal 6133 zcmb_gTW=fJ5jLqCHPnS#$u`Zz#+q?s*-5CHYMO?=1WR&FF_yRlxssKZz+$yLq&B8@ zw|h|`8~P7@=~MqfQJ^pFe+cpe`qYO!6-8bOw0$aCpmWaIrFfGq2GxtWbI#0}GxN>m z%#$yiV+TGEE5stM?vu87bSC=8M08x+w+*`|9tE8aaYe&Eam*fZbD~&Q#G0ata=EJB zMOM!aT!R$Eu5EXFWb4GXOy71*tGji&y%jjVc|vkb8i1vr5YN#KB3A0fJ>u(a-Pckj)1omr3{Db8NinQ!!GdPA`uaZ&fXyxR%~)m5FD#rh^x&jcC}s0Ocq|oXcEnAtW1%pn{I;ZG0X?mLkxZ163)3oz$Sw=?gBjJjiPb*KXnejS^GJM+Q7V#r3? znj0D`+;nST)5y}DaEXNqVsEP*UYoOK{~CkU2#%#=V!R@*umrO-q|z}lwz(*5z*5`v zoSuHBF>0JqS7E^-{;zEJReFXIQjq8xj`rHNNP3o0Zo;ZVh^yhzUlYUE%yxR7Efipm z;+Uit@N*^qQI6|4Y?j=JR=Fl+$!^0O`ys4Ca=+HB%cbh`s$5Q8L#-2~hAgSoS|t?| zlCaR&uhr;Bybw>vvcHYPjpmt!NeF{HM4hU;7;%CIYevrw+FBIO+G(C$KAA60)@`z& zT!~6~9_ECDJQu%nE%TcgT%WimJQ*}~G54Jm|F^UWA2M|!ZM;wi#D|x|gt--+AUp$s zEA9psV&c^F5YK7qpk)4bq&c$X#-gk^^PMzPOu)R)OpyKa9a!Tzk%6FOTOG42tPN?0 zEQw3d@EC+~a57-LOOc&xf&wcMXtl0u2M)teGXH6GgHSZ)ehin~n3}mL2~;RE3arAK z7kOF>nbX&qRX(09bFx2CR0ZJJ_Z`ikp^=_rG9FEqF|OARax!!7!~_`@eGCsShlW8i z|KqF5QH{Qs2Qcpt*RM}Gl6K&y6YRXV?5#t}urbwHzILMf zsHE$q7sVM=@~6=O?{We{hVt)mcJ#p#yDP@Of98<%8mh38-@dXmo{Cgt6(mS`q=y-V zCB7~~+)D#0w~}w&f2X_#p$x)JNV2ld>u!1#wMi5)EeK^;i*h`74!!ycyZVnN3m?f# zOv)}K0}rp-(~n5cOK&j#&nEMa<76LMcNwQ_`R-Xphvgwi3pBSYB9g+@yd75Ddme0#(fwnV#}?U_?fNX4%n66Es0aQr ztB_%ukf&FmsC%X%p&SIPX|OJUCbkpZd!-!{y-hJdV?BYnX(1xaGp9bA{fQ^~tmm3)EFCYLHvp~E=AYW_K_PXZ7I zDa`=`ofA?Vd~9Ho)aGE${3Q;;1cTgwrO?>usem_Lb69!?Qv~w-{#~36-4^fKnKBSwfr0zGh(yr8OYQwG82Bd~o9~~a1+QRh_Y96WI#Ky?m zNdA3%jQkTM|9WPO{3(+EHBOdlU#0%GP+W%O07^6ei9zOa*9m7Z%i@Bj(3SkF>CJe# z?A+x`G(xim+=$s+1I`E@T;<7Zt31 ziKyM_r+(_MxzVh_yWAg;H8S7M!Ahum)U99*3NvSDtyT*b!cHiRx))c4%dqI&@TY=v z2W&?SSo_+uEsfT>sN)LT<>x=}oG(#c9mR!L!aVg~eAIq(WqA|UYl^CkF2pIgxwNLn^hnXP zwMO?2lV>S8BK0quniFop^}*d2OY_BBa8qx$aVTZu*eF5_>w+?mV0EN{#K-U31AiZb zcc8(>WRGSpy+BJ(2x3eMG}%{6TD7i)`100}o7#}qg4K~4>ek8$2A(|VJ&Fza1hsp<%y!Mw}fB`gFlZ`%jB z!gma|6g``FtYLpF0GN)3;6NojK8tyX^M=9Ke8`KAL|oEZG8{;l-S?XkdK6$@-ft*% zImN)-RImbR(w^MF8iZg*hfB?>grP}iE~V70fCUISH3h{gH3Tq@VCZ*Mc`2pl>3;fk zP;FGIwW^d_c=!ug8+(Zex8YVp#*Wn%cLQmrJTiWnl&%cdsp7PVbPDr-e) zm##Fhko+MIX`GHsOk2eyH)WkpVC%7;OKfZsZKX4nu01$nM!@2f`7}R3bB-Qg;MzI* zT|84^17<$-i6$)gh{_#oe;X~fT5Rmo8k|Do82bD8ZO&XMu=PS=uRointernalAddGeneratedFile( + ' +˜ +)google/monitoring/v3/uptime_service.protogoogle.monitoring.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto!google/monitoring/v3/uptime.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"› +ListUptimeCheckConfigsRequestC +parent ( B3àAúA-+monitoring.googleapis.com/UptimeCheckConfig +filter (  + page_size ( + +page_token ( "” +ListUptimeCheckConfigsResponseE +uptime_check_configs ( 2\'.google.monitoring.v3.UptimeCheckConfig +next_page_token (  + +total_size ("` +GetUptimeCheckConfigRequestA +name ( B3àAúA- ++monitoring.googleapis.com/UptimeCheckConfig"° +CreateUptimeCheckConfigRequestC +parent ( B3àAúA-+monitoring.googleapis.com/UptimeCheckConfigI +uptime_check_config ( 2\'.google.monitoring.v3.UptimeCheckConfigBàA"œ +UpdateUptimeCheckConfigRequest/ + update_mask ( 2.google.protobuf.FieldMaskI +uptime_check_config ( 2\'.google.monitoring.v3.UptimeCheckConfigBàA"c +DeleteUptimeCheckConfigRequestA +name ( B3àAúA- ++monitoring.googleapis.com/UptimeCheckConfig"B +ListUptimeCheckIpsRequest + page_size ( + +page_token ( "t +ListUptimeCheckIpsResponse= +uptime_check_ips ( 2#.google.monitoring.v3.UptimeCheckIp +next_page_token ( 2½ + +UptimeCheckServiceÀ +ListUptimeCheckConfigs3.google.monitoring.v3.ListUptimeCheckConfigsRequest4.google.monitoring.v3.ListUptimeCheckConfigsResponse";ÚAparent‚Óä“,*/v3/{parent=projects/*}/uptimeCheckConfigs­ +GetUptimeCheckConfig1.google.monitoring.v3.GetUptimeCheckConfigRequest\'.google.monitoring.v3.UptimeCheckConfig"9ÚAname‚Óä“,*/v3/{name=projects/*/uptimeCheckConfigs/*}Þ +CreateUptimeCheckConfig4.google.monitoring.v3.CreateUptimeCheckConfigRequest\'.google.monitoring.v3.UptimeCheckConfig"dÚAparent,uptime_check_config‚Óä“A"*/v3/{parent=projects/*}/uptimeCheckConfigs:uptime_check_configë +UpdateUptimeCheckConfig4.google.monitoring.v3.UpdateUptimeCheckConfigRequest\'.google.monitoring.v3.UptimeCheckConfig"qÚAuptime_check_config‚Óä“U2>/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}:uptime_check_config¢ +DeleteUptimeCheckConfig4.google.monitoring.v3.DeleteUptimeCheckConfigRequest.google.protobuf.Empty"9ÚAname‚Óä“,**/v3/{name=projects/*/uptimeCheckConfigs/*}“ +ListUptimeCheckIps/.google.monitoring.v3.ListUptimeCheckIpsRequest0.google.monitoring.v3.ListUptimeCheckIpsResponse"‚Óä“/v3/uptimeCheckIps©ÊAmonitoring.googleapis.comÒA‰https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.readBÍ +com.google.monitoring.v3BUptimeServiceProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbªGoogle.Cloud.Monitoring.V3ÊGoogle\\Cloud\\Monitoring\\V3êGoogle::Cloud::Monitoring::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation.php new file mode 100644 index 000000000000..7d97df10e8e0 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation.php @@ -0,0 +1,389 @@ +google.monitoring.v3.Aggregation + */ +class Aggregation extends \Google\Protobuf\Internal\Message +{ + /** + * The `alignment_period` specifies a time interval, in seconds, that is used + * to divide the data in all the + * [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + * time. This will be done before the per-series aligner can be applied to + * the data. + * The value must be at least 60 seconds. If a per-series + * aligner other than `ALIGN_NONE` is specified, this field is required or an + * error is returned. If no per-series aligner is specified, or the aligner + * `ALIGN_NONE` is specified, then this field is ignored. + * The maximum value of the `alignment_period` is 104 weeks (2 years) for + * charts, and 90,000 seconds (25 hours) for alerting policies. + * + * Generated from protobuf field .google.protobuf.Duration alignment_period = 1; + */ + protected $alignment_period = null; + /** + * An `Aligner` describes how to bring the data points in a single + * time series into temporal alignment. Except for `ALIGN_NONE`, all + * alignments cause all the data points in an `alignment_period` to be + * mathematically grouped together, resulting in a single data point for + * each `alignment_period` with end timestamp at the end of the period. + * Not all alignment operations may be applied to all time series. The valid + * choices depend on the `metric_kind` and `value_type` of the original time + * series. Alignment can change the `metric_kind` or the `value_type` of + * the time series. + * Time series data must be aligned in order to perform cross-time + * series reduction. If `cross_series_reducer` is specified, then + * `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + * and `alignment_period` must be specified; otherwise, an error is + * returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Aligner per_series_aligner = 2; + */ + protected $per_series_aligner = 0; + /** + * The reduction operation to be used to combine time series into a single + * time series, where the value of each data point in the resulting series is + * a function of all the already aligned values in the input time series. + * Not all reducer operations can be applied to all time series. The valid + * choices depend on the `metric_kind` and the `value_type` of the original + * time series. Reduction can yield a time series with a different + * `metric_kind` or `value_type` than the input time series. + * Time series data must first be aligned (see `per_series_aligner`) in order + * to perform cross-time series reduction. If `cross_series_reducer` is + * specified, then `per_series_aligner` must be specified, and must not be + * `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + * error is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Reducer cross_series_reducer = 4; + */ + protected $cross_series_reducer = 0; + /** + * The set of fields to preserve when `cross_series_reducer` is + * specified. The `group_by_fields` determine how the time series are + * partitioned into subsets prior to applying the aggregation + * operation. Each subset contains time series that have the same + * value for each of the grouping fields. Each individual time + * series is a member of exactly one subset. The + * `cross_series_reducer` is applied to each subset of time series. + * It is not possible to reduce across different resource types, so + * this field implicitly contains `resource.type`. Fields not + * specified in `group_by_fields` are aggregated away. If + * `group_by_fields` is not specified and all the time series have + * the same resource type, then the time series are aggregated into + * a single output time series. If `cross_series_reducer` is not + * defined, this field is ignored. + * + * Generated from protobuf field repeated string group_by_fields = 5; + */ + private $group_by_fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $alignment_period + * The `alignment_period` specifies a time interval, in seconds, that is used + * to divide the data in all the + * [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + * time. This will be done before the per-series aligner can be applied to + * the data. + * The value must be at least 60 seconds. If a per-series + * aligner other than `ALIGN_NONE` is specified, this field is required or an + * error is returned. If no per-series aligner is specified, or the aligner + * `ALIGN_NONE` is specified, then this field is ignored. + * The maximum value of the `alignment_period` is 104 weeks (2 years) for + * charts, and 90,000 seconds (25 hours) for alerting policies. + * @type int $per_series_aligner + * An `Aligner` describes how to bring the data points in a single + * time series into temporal alignment. Except for `ALIGN_NONE`, all + * alignments cause all the data points in an `alignment_period` to be + * mathematically grouped together, resulting in a single data point for + * each `alignment_period` with end timestamp at the end of the period. + * Not all alignment operations may be applied to all time series. The valid + * choices depend on the `metric_kind` and `value_type` of the original time + * series. Alignment can change the `metric_kind` or the `value_type` of + * the time series. + * Time series data must be aligned in order to perform cross-time + * series reduction. If `cross_series_reducer` is specified, then + * `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + * and `alignment_period` must be specified; otherwise, an error is + * returned. + * @type int $cross_series_reducer + * The reduction operation to be used to combine time series into a single + * time series, where the value of each data point in the resulting series is + * a function of all the already aligned values in the input time series. + * Not all reducer operations can be applied to all time series. The valid + * choices depend on the `metric_kind` and the `value_type` of the original + * time series. Reduction can yield a time series with a different + * `metric_kind` or `value_type` than the input time series. + * Time series data must first be aligned (see `per_series_aligner`) in order + * to perform cross-time series reduction. If `cross_series_reducer` is + * specified, then `per_series_aligner` must be specified, and must not be + * `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + * error is returned. + * @type array|\Google\Protobuf\Internal\RepeatedField $group_by_fields + * The set of fields to preserve when `cross_series_reducer` is + * specified. The `group_by_fields` determine how the time series are + * partitioned into subsets prior to applying the aggregation + * operation. Each subset contains time series that have the same + * value for each of the grouping fields. Each individual time + * series is a member of exactly one subset. The + * `cross_series_reducer` is applied to each subset of time series. + * It is not possible to reduce across different resource types, so + * this field implicitly contains `resource.type`. Fields not + * specified in `group_by_fields` are aggregated away. If + * `group_by_fields` is not specified and all the time series have + * the same resource type, then the time series are aggregated into + * a single output time series. If `cross_series_reducer` is not + * defined, this field is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * The `alignment_period` specifies a time interval, in seconds, that is used + * to divide the data in all the + * [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + * time. This will be done before the per-series aligner can be applied to + * the data. + * The value must be at least 60 seconds. If a per-series + * aligner other than `ALIGN_NONE` is specified, this field is required or an + * error is returned. If no per-series aligner is specified, or the aligner + * `ALIGN_NONE` is specified, then this field is ignored. + * The maximum value of the `alignment_period` is 104 weeks (2 years) for + * charts, and 90,000 seconds (25 hours) for alerting policies. + * + * Generated from protobuf field .google.protobuf.Duration alignment_period = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getAlignmentPeriod() + { + return $this->alignment_period; + } + + public function hasAlignmentPeriod() + { + return isset($this->alignment_period); + } + + public function clearAlignmentPeriod() + { + unset($this->alignment_period); + } + + /** + * The `alignment_period` specifies a time interval, in seconds, that is used + * to divide the data in all the + * [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + * time. This will be done before the per-series aligner can be applied to + * the data. + * The value must be at least 60 seconds. If a per-series + * aligner other than `ALIGN_NONE` is specified, this field is required or an + * error is returned. If no per-series aligner is specified, or the aligner + * `ALIGN_NONE` is specified, then this field is ignored. + * The maximum value of the `alignment_period` is 104 weeks (2 years) for + * charts, and 90,000 seconds (25 hours) for alerting policies. + * + * Generated from protobuf field .google.protobuf.Duration alignment_period = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setAlignmentPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->alignment_period = $var; + + return $this; + } + + /** + * An `Aligner` describes how to bring the data points in a single + * time series into temporal alignment. Except for `ALIGN_NONE`, all + * alignments cause all the data points in an `alignment_period` to be + * mathematically grouped together, resulting in a single data point for + * each `alignment_period` with end timestamp at the end of the period. + * Not all alignment operations may be applied to all time series. The valid + * choices depend on the `metric_kind` and `value_type` of the original time + * series. Alignment can change the `metric_kind` or the `value_type` of + * the time series. + * Time series data must be aligned in order to perform cross-time + * series reduction. If `cross_series_reducer` is specified, then + * `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + * and `alignment_period` must be specified; otherwise, an error is + * returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Aligner per_series_aligner = 2; + * @return int + */ + public function getPerSeriesAligner() + { + return $this->per_series_aligner; + } + + /** + * An `Aligner` describes how to bring the data points in a single + * time series into temporal alignment. Except for `ALIGN_NONE`, all + * alignments cause all the data points in an `alignment_period` to be + * mathematically grouped together, resulting in a single data point for + * each `alignment_period` with end timestamp at the end of the period. + * Not all alignment operations may be applied to all time series. The valid + * choices depend on the `metric_kind` and `value_type` of the original time + * series. Alignment can change the `metric_kind` or the `value_type` of + * the time series. + * Time series data must be aligned in order to perform cross-time + * series reduction. If `cross_series_reducer` is specified, then + * `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + * and `alignment_period` must be specified; otherwise, an error is + * returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Aligner per_series_aligner = 2; + * @param int $var + * @return $this + */ + public function setPerSeriesAligner($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation\Aligner::class); + $this->per_series_aligner = $var; + + return $this; + } + + /** + * The reduction operation to be used to combine time series into a single + * time series, where the value of each data point in the resulting series is + * a function of all the already aligned values in the input time series. + * Not all reducer operations can be applied to all time series. The valid + * choices depend on the `metric_kind` and the `value_type` of the original + * time series. Reduction can yield a time series with a different + * `metric_kind` or `value_type` than the input time series. + * Time series data must first be aligned (see `per_series_aligner`) in order + * to perform cross-time series reduction. If `cross_series_reducer` is + * specified, then `per_series_aligner` must be specified, and must not be + * `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + * error is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Reducer cross_series_reducer = 4; + * @return int + */ + public function getCrossSeriesReducer() + { + return $this->cross_series_reducer; + } + + /** + * The reduction operation to be used to combine time series into a single + * time series, where the value of each data point in the resulting series is + * a function of all the already aligned values in the input time series. + * Not all reducer operations can be applied to all time series. The valid + * choices depend on the `metric_kind` and the `value_type` of the original + * time series. Reduction can yield a time series with a different + * `metric_kind` or `value_type` than the input time series. + * Time series data must first be aligned (see `per_series_aligner`) in order + * to perform cross-time series reduction. If `cross_series_reducer` is + * specified, then `per_series_aligner` must be specified, and must not be + * `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + * error is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation.Reducer cross_series_reducer = 4; + * @param int $var + * @return $this + */ + public function setCrossSeriesReducer($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation\Reducer::class); + $this->cross_series_reducer = $var; + + return $this; + } + + /** + * The set of fields to preserve when `cross_series_reducer` is + * specified. The `group_by_fields` determine how the time series are + * partitioned into subsets prior to applying the aggregation + * operation. Each subset contains time series that have the same + * value for each of the grouping fields. Each individual time + * series is a member of exactly one subset. The + * `cross_series_reducer` is applied to each subset of time series. + * It is not possible to reduce across different resource types, so + * this field implicitly contains `resource.type`. Fields not + * specified in `group_by_fields` are aggregated away. If + * `group_by_fields` is not specified and all the time series have + * the same resource type, then the time series are aggregated into + * a single output time series. If `cross_series_reducer` is not + * defined, this field is ignored. + * + * Generated from protobuf field repeated string group_by_fields = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroupByFields() + { + return $this->group_by_fields; + } + + /** + * The set of fields to preserve when `cross_series_reducer` is + * specified. The `group_by_fields` determine how the time series are + * partitioned into subsets prior to applying the aggregation + * operation. Each subset contains time series that have the same + * value for each of the grouping fields. Each individual time + * series is a member of exactly one subset. The + * `cross_series_reducer` is applied to each subset of time series. + * It is not possible to reduce across different resource types, so + * this field implicitly contains `resource.type`. Fields not + * specified in `group_by_fields` are aggregated away. If + * `group_by_fields` is not specified and all the time series have + * the same resource type, then the time series are aggregated into + * a single output time series. If `cross_series_reducer` is not + * defined, this field is ignored. + * + * Generated from protobuf field repeated string group_by_fields = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroupByFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->group_by_fields = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Aligner.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Aligner.php new file mode 100644 index 000000000000..9f2767800daf --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Aligner.php @@ -0,0 +1,269 @@ +google.monitoring.v3.Aggregation.Aligner + */ +class Aligner +{ + /** + * No alignment. Raw data is returned. Not valid if cross-series reduction + * is requested. The `value_type` of the result is the same as the + * `value_type` of the input. + * + * Generated from protobuf enum ALIGN_NONE = 0; + */ + const ALIGN_NONE = 0; + /** + * Align and convert to + * [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. + * The output is `delta = y1 - y0`. + * This alignment is valid for + * [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and + * `DELTA` metrics. If the selected alignment period results in periods + * with no data, then the aligned value for such a period is created by + * interpolation. The `value_type` of the aligned result is the same as + * the `value_type` of the input. + * + * Generated from protobuf enum ALIGN_DELTA = 1; + */ + const ALIGN_DELTA = 1; + /** + * Align and convert to a rate. The result is computed as + * `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". + * Think of this aligner as providing the slope of the line that passes + * through the value at the start and at the end of the `alignment_period`. + * This aligner is valid for `CUMULATIVE` + * and `DELTA` metrics with numeric values. If the selected alignment + * period results in periods with no data, then the aligned value for + * such a period is created by interpolation. The output is a `GAUGE` + * metric with `value_type` `DOUBLE`. + * If, by "rate", you mean "percentage change", see the + * `ALIGN_PERCENT_CHANGE` aligner instead. + * + * Generated from protobuf enum ALIGN_RATE = 2; + */ + const ALIGN_RATE = 2; + /** + * Align by interpolating between adjacent points around the alignment + * period boundary. This aligner is valid for `GAUGE` metrics with + * numeric values. The `value_type` of the aligned result is the same as the + * `value_type` of the input. + * + * Generated from protobuf enum ALIGN_INTERPOLATE = 3; + */ + const ALIGN_INTERPOLATE = 3; + /** + * Align by moving the most recent data point before the end of the + * alignment period to the boundary at the end of the alignment + * period. This aligner is valid for `GAUGE` metrics. The `value_type` of + * the aligned result is the same as the `value_type` of the input. + * + * Generated from protobuf enum ALIGN_NEXT_OLDER = 4; + */ + const ALIGN_NEXT_OLDER = 4; + /** + * Align the time series by returning the minimum value in each alignment + * period. This aligner is valid for `GAUGE` and `DELTA` metrics with + * numeric values. The `value_type` of the aligned result is the same as + * the `value_type` of the input. + * + * Generated from protobuf enum ALIGN_MIN = 10; + */ + const ALIGN_MIN = 10; + /** + * Align the time series by returning the maximum value in each alignment + * period. This aligner is valid for `GAUGE` and `DELTA` metrics with + * numeric values. The `value_type` of the aligned result is the same as + * the `value_type` of the input. + * + * Generated from protobuf enum ALIGN_MAX = 11; + */ + const ALIGN_MAX = 11; + /** + * Align the time series by returning the mean value in each alignment + * period. This aligner is valid for `GAUGE` and `DELTA` metrics with + * numeric values. The `value_type` of the aligned result is `DOUBLE`. + * + * Generated from protobuf enum ALIGN_MEAN = 12; + */ + const ALIGN_MEAN = 12; + /** + * Align the time series by returning the number of values in each alignment + * period. This aligner is valid for `GAUGE` and `DELTA` metrics with + * numeric or Boolean values. The `value_type` of the aligned result is + * `INT64`. + * + * Generated from protobuf enum ALIGN_COUNT = 13; + */ + const ALIGN_COUNT = 13; + /** + * Align the time series by returning the sum of the values in each + * alignment period. This aligner is valid for `GAUGE` and `DELTA` + * metrics with numeric and distribution values. The `value_type` of the + * aligned result is the same as the `value_type` of the input. + * + * Generated from protobuf enum ALIGN_SUM = 14; + */ + const ALIGN_SUM = 14; + /** + * Align the time series by returning the standard deviation of the values + * in each alignment period. This aligner is valid for `GAUGE` and + * `DELTA` metrics with numeric values. The `value_type` of the output is + * `DOUBLE`. + * + * Generated from protobuf enum ALIGN_STDDEV = 15; + */ + const ALIGN_STDDEV = 15; + /** + * Align the time series by returning the number of `True` values in + * each alignment period. This aligner is valid for `GAUGE` metrics with + * Boolean values. The `value_type` of the output is `INT64`. + * + * Generated from protobuf enum ALIGN_COUNT_TRUE = 16; + */ + const ALIGN_COUNT_TRUE = 16; + /** + * Align the time series by returning the number of `False` values in + * each alignment period. This aligner is valid for `GAUGE` metrics with + * Boolean values. The `value_type` of the output is `INT64`. + * + * Generated from protobuf enum ALIGN_COUNT_FALSE = 24; + */ + const ALIGN_COUNT_FALSE = 24; + /** + * Align the time series by returning the ratio of the number of `True` + * values to the total number of values in each alignment period. This + * aligner is valid for `GAUGE` metrics with Boolean values. The output + * value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_FRACTION_TRUE = 17; + */ + const ALIGN_FRACTION_TRUE = 17; + /** + * Align the time series by using [percentile + * aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + * data point in each alignment period is the 99th percentile of all data + * points in the period. This aligner is valid for `GAUGE` and `DELTA` + * metrics with distribution values. The output is a `GAUGE` metric with + * `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_PERCENTILE_99 = 18; + */ + const ALIGN_PERCENTILE_99 = 18; + /** + * Align the time series by using [percentile + * aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + * data point in each alignment period is the 95th percentile of all data + * points in the period. This aligner is valid for `GAUGE` and `DELTA` + * metrics with distribution values. The output is a `GAUGE` metric with + * `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_PERCENTILE_95 = 19; + */ + const ALIGN_PERCENTILE_95 = 19; + /** + * Align the time series by using [percentile + * aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + * data point in each alignment period is the 50th percentile of all data + * points in the period. This aligner is valid for `GAUGE` and `DELTA` + * metrics with distribution values. The output is a `GAUGE` metric with + * `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_PERCENTILE_50 = 20; + */ + const ALIGN_PERCENTILE_50 = 20; + /** + * Align the time series by using [percentile + * aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + * data point in each alignment period is the 5th percentile of all data + * points in the period. This aligner is valid for `GAUGE` and `DELTA` + * metrics with distribution values. The output is a `GAUGE` metric with + * `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_PERCENTILE_05 = 21; + */ + const ALIGN_PERCENTILE_05 = 21; + /** + * Align and convert to a percentage change. This aligner is valid for + * `GAUGE` and `DELTA` metrics with numeric values. This alignment returns + * `((current - previous)/previous) * 100`, where the value of `previous` is + * determined based on the `alignment_period`. + * If the values of `current` and `previous` are both 0, then the returned + * value is 0. If only `previous` is 0, the returned value is infinity. + * A 10-minute moving mean is computed at each point of the alignment period + * prior to the above calculation to smooth the metric and prevent false + * positives from very short-lived spikes. The moving mean is only + * applicable for data whose values are `>= 0`. Any values `< 0` are + * treated as a missing datapoint, and are ignored. While `DELTA` + * metrics are accepted by this alignment, special care should be taken that + * the values for the metric will always be positive. The output is a + * `GAUGE` metric with `value_type` `DOUBLE`. + * + * Generated from protobuf enum ALIGN_PERCENT_CHANGE = 23; + */ + const ALIGN_PERCENT_CHANGE = 23; + + private static $valueToName = [ + self::ALIGN_NONE => 'ALIGN_NONE', + self::ALIGN_DELTA => 'ALIGN_DELTA', + self::ALIGN_RATE => 'ALIGN_RATE', + self::ALIGN_INTERPOLATE => 'ALIGN_INTERPOLATE', + self::ALIGN_NEXT_OLDER => 'ALIGN_NEXT_OLDER', + self::ALIGN_MIN => 'ALIGN_MIN', + self::ALIGN_MAX => 'ALIGN_MAX', + self::ALIGN_MEAN => 'ALIGN_MEAN', + self::ALIGN_COUNT => 'ALIGN_COUNT', + self::ALIGN_SUM => 'ALIGN_SUM', + self::ALIGN_STDDEV => 'ALIGN_STDDEV', + self::ALIGN_COUNT_TRUE => 'ALIGN_COUNT_TRUE', + self::ALIGN_COUNT_FALSE => 'ALIGN_COUNT_FALSE', + self::ALIGN_FRACTION_TRUE => 'ALIGN_FRACTION_TRUE', + self::ALIGN_PERCENTILE_99 => 'ALIGN_PERCENTILE_99', + self::ALIGN_PERCENTILE_95 => 'ALIGN_PERCENTILE_95', + self::ALIGN_PERCENTILE_50 => 'ALIGN_PERCENTILE_50', + self::ALIGN_PERCENTILE_05 => 'ALIGN_PERCENTILE_05', + self::ALIGN_PERCENT_CHANGE => 'ALIGN_PERCENT_CHANGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aligner::class, \Google\Cloud\Monitoring\V3\Aggregation_Aligner::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Reducer.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Reducer.php new file mode 100644 index 000000000000..c5d065c3b4e6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Aggregation/Reducer.php @@ -0,0 +1,191 @@ +google.monitoring.v3.Aggregation.Reducer + */ +class Reducer +{ + /** + * No cross-time series reduction. The output of the `Aligner` is + * returned. + * + * Generated from protobuf enum REDUCE_NONE = 0; + */ + const REDUCE_NONE = 0; + /** + * Reduce by computing the mean value across time series for each + * alignment period. This reducer is valid for + * [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and + * [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with + * numeric or distribution values. The `value_type` of the output is + * [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + * + * Generated from protobuf enum REDUCE_MEAN = 1; + */ + const REDUCE_MEAN = 1; + /** + * Reduce by computing the minimum value across time series for each + * alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + * with numeric values. The `value_type` of the output is the same as the + * `value_type` of the input. + * + * Generated from protobuf enum REDUCE_MIN = 2; + */ + const REDUCE_MIN = 2; + /** + * Reduce by computing the maximum value across time series for each + * alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + * with numeric values. The `value_type` of the output is the same as the + * `value_type` of the input. + * + * Generated from protobuf enum REDUCE_MAX = 3; + */ + const REDUCE_MAX = 3; + /** + * Reduce by computing the sum across time series for each + * alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + * with numeric and distribution values. The `value_type` of the output is + * the same as the `value_type` of the input. + * + * Generated from protobuf enum REDUCE_SUM = 4; + */ + const REDUCE_SUM = 4; + /** + * Reduce by computing the standard deviation across time series + * for each alignment period. This reducer is valid for `DELTA` and + * `GAUGE` metrics with numeric or distribution values. The `value_type` + * of the output is `DOUBLE`. + * + * Generated from protobuf enum REDUCE_STDDEV = 5; + */ + const REDUCE_STDDEV = 5; + /** + * Reduce by computing the number of data points across time series + * for each alignment period. This reducer is valid for `DELTA` and + * `GAUGE` metrics of numeric, Boolean, distribution, and string + * `value_type`. The `value_type` of the output is `INT64`. + * + * Generated from protobuf enum REDUCE_COUNT = 6; + */ + const REDUCE_COUNT = 6; + /** + * Reduce by computing the number of `True`-valued data points across time + * series for each alignment period. This reducer is valid for `DELTA` and + * `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + * is `INT64`. + * + * Generated from protobuf enum REDUCE_COUNT_TRUE = 7; + */ + const REDUCE_COUNT_TRUE = 7; + /** + * Reduce by computing the number of `False`-valued data points across time + * series for each alignment period. This reducer is valid for `DELTA` and + * `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + * is `INT64`. + * + * Generated from protobuf enum REDUCE_COUNT_FALSE = 15; + */ + const REDUCE_COUNT_FALSE = 15; + /** + * Reduce by computing the ratio of the number of `True`-valued data points + * to the total number of data points for each alignment period. This + * reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. + * The output value is in the range [0.0, 1.0] and has `value_type` + * `DOUBLE`. + * + * Generated from protobuf enum REDUCE_FRACTION_TRUE = 8; + */ + const REDUCE_FRACTION_TRUE = 8; + /** + * Reduce by computing the [99th + * percentile](https://en.wikipedia.org/wiki/Percentile) of data points + * across time series for each alignment period. This reducer is valid for + * `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + * of the output is `DOUBLE`. + * + * Generated from protobuf enum REDUCE_PERCENTILE_99 = 9; + */ + const REDUCE_PERCENTILE_99 = 9; + /** + * Reduce by computing the [95th + * percentile](https://en.wikipedia.org/wiki/Percentile) of data points + * across time series for each alignment period. This reducer is valid for + * `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + * of the output is `DOUBLE`. + * + * Generated from protobuf enum REDUCE_PERCENTILE_95 = 10; + */ + const REDUCE_PERCENTILE_95 = 10; + /** + * Reduce by computing the [50th + * percentile](https://en.wikipedia.org/wiki/Percentile) of data points + * across time series for each alignment period. This reducer is valid for + * `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + * of the output is `DOUBLE`. + * + * Generated from protobuf enum REDUCE_PERCENTILE_50 = 11; + */ + const REDUCE_PERCENTILE_50 = 11; + /** + * Reduce by computing the [5th + * percentile](https://en.wikipedia.org/wiki/Percentile) of data points + * across time series for each alignment period. This reducer is valid for + * `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + * of the output is `DOUBLE`. + * + * Generated from protobuf enum REDUCE_PERCENTILE_05 = 12; + */ + const REDUCE_PERCENTILE_05 = 12; + + private static $valueToName = [ + self::REDUCE_NONE => 'REDUCE_NONE', + self::REDUCE_MEAN => 'REDUCE_MEAN', + self::REDUCE_MIN => 'REDUCE_MIN', + self::REDUCE_MAX => 'REDUCE_MAX', + self::REDUCE_SUM => 'REDUCE_SUM', + self::REDUCE_STDDEV => 'REDUCE_STDDEV', + self::REDUCE_COUNT => 'REDUCE_COUNT', + self::REDUCE_COUNT_TRUE => 'REDUCE_COUNT_TRUE', + self::REDUCE_COUNT_FALSE => 'REDUCE_COUNT_FALSE', + self::REDUCE_FRACTION_TRUE => 'REDUCE_FRACTION_TRUE', + self::REDUCE_PERCENTILE_99 => 'REDUCE_PERCENTILE_99', + self::REDUCE_PERCENTILE_95 => 'REDUCE_PERCENTILE_95', + self::REDUCE_PERCENTILE_50 => 'REDUCE_PERCENTILE_50', + self::REDUCE_PERCENTILE_05 => 'REDUCE_PERCENTILE_05', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Reducer::class, \Google\Cloud\Monitoring\V3\Aggregation_Reducer::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy.php new file mode 100644 index 000000000000..c9b92c00eff9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy.php @@ -0,0 +1,805 @@ +google.monitoring.v3.AlertPolicy + */ +class AlertPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Required if the policy exists. The resource name for this + * policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy + * is created. When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the alerting policy passed as + * part of the request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * A short name or phrase used to identify the policy in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple policies in the same project. The name is + * limited to 512 Unicode characters. + * The convention for the display_name of a PrometheusQueryLanguageCondition + * is "{rule group name}/{alert name}", where the {rule group name} and + * {alert name} should be taken from the corresponding Prometheus + * configuration file. This convention is not enforced. + * In any case the display_name is not a unique key of the AlertPolicy. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Documentation that is included with notifications and incidents related to + * this policy. Best practice is for the documentation to include information + * to help responders understand, mitigate, escalate, and correct the + * underlying problems detected by the alerting policy. Notification channels + * that have limited capacity might not show this documentation. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Documentation documentation = 13; + */ + protected $documentation = null; + /** + * User-supplied key/value data to be used for organizing and + * identifying the `AlertPolicy` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * Note that Prometheus {alert name} is a + * [valid Prometheus label + * names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels), + * whereas Prometheus {rule group} is an unrestricted UTF-8 string. + * This means that they cannot be stored as-is in user labels, because + * they may contain characters that are not allowed in user-label values. + * + * Generated from protobuf field map user_labels = 16; + */ + private $user_labels; + /** + * A list of conditions for the policy. The conditions are combined by AND or + * OR according to the `combiner` field. If the combined conditions evaluate + * to true, then an incident is created. A policy can have from one to six + * conditions. + * If `condition_time_series_query_language` is present, it must be the only + * `condition`. + * If `condition_monitoring_query_language` is present, it must be the only + * `condition`. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12; + */ + private $conditions; + /** + * How to combine the results of multiple conditions to determine if an + * incident should be opened. + * If `condition_time_series_query_language` is present, this must be + * `COMBINE_UNSPECIFIED`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6; + */ + protected $combiner = 0; + /** + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 17; + */ + protected $enabled = null; + /** + * Read-only description of how the alerting policy is invalid. This field is + * only set when the alerting policy is invalid. An invalid alerting policy + * will not generate incidents. + * + * Generated from protobuf field .google.rpc.Status validity = 18; + */ + protected $validity = null; + /** + * Identifies the notification channels to which notifications should be sent + * when incidents are opened or closed or when new violations occur on + * an already opened incident. Each element of this array corresponds to + * the `name` field in each of the + * [`NotificationChannel`][google.monitoring.v3.NotificationChannel] + * objects that are returned from the [`ListNotificationChannels`] + * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * method. The format of the entries in this field is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channels = 14; + */ + private $notification_channels; + /** + * A read-only record of the creation of the alerting policy. If provided + * in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 10; + */ + protected $creation_record = null; + /** + * A read-only record of the most recent change to the alerting policy. If + * provided in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord mutation_record = 11; + */ + protected $mutation_record = null; + /** + * Control over how this alerting policy's notification channels are notified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy alert_strategy = 21; + */ + protected $alert_strategy = null; + /** + * Optional. The severity of an alerting policy indicates how important + * incidents generated by that policy are. The severity level will be + * displayed on the Incident detail page and in notifications. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Severity severity = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $severity = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. Required if the policy exists. The resource name for this + * policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy + * is created. When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the alerting policy passed as + * part of the request. + * @type string $display_name + * A short name or phrase used to identify the policy in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple policies in the same project. The name is + * limited to 512 Unicode characters. + * The convention for the display_name of a PrometheusQueryLanguageCondition + * is "{rule group name}/{alert name}", where the {rule group name} and + * {alert name} should be taken from the corresponding Prometheus + * configuration file. This convention is not enforced. + * In any case the display_name is not a unique key of the AlertPolicy. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation $documentation + * Documentation that is included with notifications and incidents related to + * this policy. Best practice is for the documentation to include information + * to help responders understand, mitigate, escalate, and correct the + * underlying problems detected by the alerting policy. Notification channels + * that have limited capacity might not show this documentation. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * User-supplied key/value data to be used for organizing and + * identifying the `AlertPolicy` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * Note that Prometheus {alert name} is a + * [valid Prometheus label + * names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels), + * whereas Prometheus {rule group} is an unrestricted UTF-8 string. + * This means that they cannot be stored as-is in user labels, because + * they may contain characters that are not allowed in user-label values. + * @type array<\Google\Cloud\Monitoring\V3\AlertPolicy\Condition>|\Google\Protobuf\Internal\RepeatedField $conditions + * A list of conditions for the policy. The conditions are combined by AND or + * OR according to the `combiner` field. If the combined conditions evaluate + * to true, then an incident is created. A policy can have from one to six + * conditions. + * If `condition_time_series_query_language` is present, it must be the only + * `condition`. + * If `condition_monitoring_query_language` is present, it must be the only + * `condition`. + * @type int $combiner + * How to combine the results of multiple conditions to determine if an + * incident should be opened. + * If `condition_time_series_query_language` is present, this must be + * `COMBINE_UNSPECIFIED`. + * @type \Google\Protobuf\BoolValue $enabled + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * @type \Google\Rpc\Status $validity + * Read-only description of how the alerting policy is invalid. This field is + * only set when the alerting policy is invalid. An invalid alerting policy + * will not generate incidents. + * @type array|\Google\Protobuf\Internal\RepeatedField $notification_channels + * Identifies the notification channels to which notifications should be sent + * when incidents are opened or closed or when new violations occur on + * an already opened incident. Each element of this array corresponds to + * the `name` field in each of the + * [`NotificationChannel`][google.monitoring.v3.NotificationChannel] + * objects that are returned from the [`ListNotificationChannels`] + * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * method. The format of the entries in this field is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @type \Google\Cloud\Monitoring\V3\MutationRecord $creation_record + * A read-only record of the creation of the alerting policy. If provided + * in a call to create or update, this field will be ignored. + * @type \Google\Cloud\Monitoring\V3\MutationRecord $mutation_record + * A read-only record of the most recent change to the alerting policy. If + * provided in a call to create or update, this field will be ignored. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy $alert_strategy + * Control over how this alerting policy's notification channels are notified. + * @type int $severity + * Optional. The severity of an alerting policy indicates how important + * incidents generated by that policy are. The severity level will be + * displayed on the Incident detail page and in notifications. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. Required if the policy exists. The resource name for this + * policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy + * is created. When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the alerting policy passed as + * part of the request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Required if the policy exists. The resource name for this + * policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy + * is created. When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the alerting policy passed as + * part of the request. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A short name or phrase used to identify the policy in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple policies in the same project. The name is + * limited to 512 Unicode characters. + * The convention for the display_name of a PrometheusQueryLanguageCondition + * is "{rule group name}/{alert name}", where the {rule group name} and + * {alert name} should be taken from the corresponding Prometheus + * configuration file. This convention is not enforced. + * In any case the display_name is not a unique key of the AlertPolicy. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A short name or phrase used to identify the policy in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple policies in the same project. The name is + * limited to 512 Unicode characters. + * The convention for the display_name of a PrometheusQueryLanguageCondition + * is "{rule group name}/{alert name}", where the {rule group name} and + * {alert name} should be taken from the corresponding Prometheus + * configuration file. This convention is not enforced. + * In any case the display_name is not a unique key of the AlertPolicy. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Documentation that is included with notifications and incidents related to + * this policy. Best practice is for the documentation to include information + * to help responders understand, mitigate, escalate, and correct the + * underlying problems detected by the alerting policy. Notification channels + * that have limited capacity might not show this documentation. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Documentation documentation = 13; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation|null + */ + public function getDocumentation() + { + return $this->documentation; + } + + public function hasDocumentation() + { + return isset($this->documentation); + } + + public function clearDocumentation() + { + unset($this->documentation); + } + + /** + * Documentation that is included with notifications and incidents related to + * this policy. Best practice is for the documentation to include information + * to help responders understand, mitigate, escalate, and correct the + * underlying problems detected by the alerting policy. Notification channels + * that have limited capacity might not show this documentation. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Documentation documentation = 13; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation $var + * @return $this + */ + public function setDocumentation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation::class); + $this->documentation = $var; + + return $this; + } + + /** + * User-supplied key/value data to be used for organizing and + * identifying the `AlertPolicy` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * Note that Prometheus {alert name} is a + * [valid Prometheus label + * names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels), + * whereas Prometheus {rule group} is an unrestricted UTF-8 string. + * This means that they cannot be stored as-is in user labels, because + * they may contain characters that are not allowed in user-label values. + * + * Generated from protobuf field map user_labels = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * User-supplied key/value data to be used for organizing and + * identifying the `AlertPolicy` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * Note that Prometheus {alert name} is a + * [valid Prometheus label + * names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels), + * whereas Prometheus {rule group} is an unrestricted UTF-8 string. + * This means that they cannot be stored as-is in user labels, because + * they may contain characters that are not allowed in user-label values. + * + * Generated from protobuf field map user_labels = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + + /** + * A list of conditions for the policy. The conditions are combined by AND or + * OR according to the `combiner` field. If the combined conditions evaluate + * to true, then an incident is created. A policy can have from one to six + * conditions. + * If `condition_time_series_query_language` is present, it must be the only + * `condition`. + * If `condition_monitoring_query_language` is present, it must be the only + * `condition`. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConditions() + { + return $this->conditions; + } + + /** + * A list of conditions for the policy. The conditions are combined by AND or + * OR according to the `combiner` field. If the combined conditions evaluate + * to true, then an incident is created. A policy can have from one to six + * conditions. + * If `condition_time_series_query_language` is present, it must be the only + * `condition`. + * If `condition_monitoring_query_language` is present, it must be the only + * `condition`. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12; + * @param array<\Google\Cloud\Monitoring\V3\AlertPolicy\Condition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition::class); + $this->conditions = $arr; + + return $this; + } + + /** + * How to combine the results of multiple conditions to determine if an + * incident should be opened. + * If `condition_time_series_query_language` is present, this must be + * `COMBINE_UNSPECIFIED`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6; + * @return int + */ + public function getCombiner() + { + return $this->combiner; + } + + /** + * How to combine the results of multiple conditions to determine if an + * incident should be opened. + * If `condition_time_series_query_language` is present, this must be + * `COMBINE_UNSPECIFIED`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6; + * @param int $var + * @return $this + */ + public function setCombiner($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy\ConditionCombinerType::class); + $this->combiner = $var; + + return $this; + } + + /** + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 17; + * @return \Google\Protobuf\BoolValue|null + */ + public function getEnabled() + { + return $this->enabled; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Returns the unboxed value from getEnabled() + + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 17; + * @return bool|null + */ + public function getEnabledUnwrapped() + { + return $this->readWrapperValue("enabled"); + } + + /** + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 17; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->enabled = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object. + + * Whether or not the policy is enabled. On write, the default interpretation + * if unset is that the policy is enabled. On read, clients should not make + * any assumption about the state if it has not been populated. The + * field should always be populated on List and Get operations, unless + * a field projection has been specified that strips it out. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 17; + * @param bool|null $var + * @return $this + */ + public function setEnabledUnwrapped($var) + { + $this->writeWrapperValue("enabled", $var); + return $this;} + + /** + * Read-only description of how the alerting policy is invalid. This field is + * only set when the alerting policy is invalid. An invalid alerting policy + * will not generate incidents. + * + * Generated from protobuf field .google.rpc.Status validity = 18; + * @return \Google\Rpc\Status|null + */ + public function getValidity() + { + return $this->validity; + } + + public function hasValidity() + { + return isset($this->validity); + } + + public function clearValidity() + { + unset($this->validity); + } + + /** + * Read-only description of how the alerting policy is invalid. This field is + * only set when the alerting policy is invalid. An invalid alerting policy + * will not generate incidents. + * + * Generated from protobuf field .google.rpc.Status validity = 18; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setValidity($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->validity = $var; + + return $this; + } + + /** + * Identifies the notification channels to which notifications should be sent + * when incidents are opened or closed or when new violations occur on + * an already opened incident. Each element of this array corresponds to + * the `name` field in each of the + * [`NotificationChannel`][google.monitoring.v3.NotificationChannel] + * objects that are returned from the [`ListNotificationChannels`] + * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * method. The format of the entries in this field is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channels = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationChannels() + { + return $this->notification_channels; + } + + /** + * Identifies the notification channels to which notifications should be sent + * when incidents are opened or closed or when new violations occur on + * an already opened incident. Each element of this array corresponds to + * the `name` field in each of the + * [`NotificationChannel`][google.monitoring.v3.NotificationChannel] + * objects that are returned from the [`ListNotificationChannels`] + * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * method. The format of the entries in this field is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channels = 14; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationChannels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->notification_channels = $arr; + + return $this; + } + + /** + * A read-only record of the creation of the alerting policy. If provided + * in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 10; + * @return \Google\Cloud\Monitoring\V3\MutationRecord|null + */ + public function getCreationRecord() + { + return $this->creation_record; + } + + public function hasCreationRecord() + { + return isset($this->creation_record); + } + + public function clearCreationRecord() + { + unset($this->creation_record); + } + + /** + * A read-only record of the creation of the alerting policy. If provided + * in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 10; + * @param \Google\Cloud\Monitoring\V3\MutationRecord $var + * @return $this + */ + public function setCreationRecord($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class); + $this->creation_record = $var; + + return $this; + } + + /** + * A read-only record of the most recent change to the alerting policy. If + * provided in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord mutation_record = 11; + * @return \Google\Cloud\Monitoring\V3\MutationRecord|null + */ + public function getMutationRecord() + { + return $this->mutation_record; + } + + public function hasMutationRecord() + { + return isset($this->mutation_record); + } + + public function clearMutationRecord() + { + unset($this->mutation_record); + } + + /** + * A read-only record of the most recent change to the alerting policy. If + * provided in a call to create or update, this field will be ignored. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord mutation_record = 11; + * @param \Google\Cloud\Monitoring\V3\MutationRecord $var + * @return $this + */ + public function setMutationRecord($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class); + $this->mutation_record = $var; + + return $this; + } + + /** + * Control over how this alerting policy's notification channels are notified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy alert_strategy = 21; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy|null + */ + public function getAlertStrategy() + { + return $this->alert_strategy; + } + + public function hasAlertStrategy() + { + return isset($this->alert_strategy); + } + + public function clearAlertStrategy() + { + unset($this->alert_strategy); + } + + /** + * Control over how this alerting policy's notification channels are notified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy alert_strategy = 21; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy $var + * @return $this + */ + public function setAlertStrategy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy::class); + $this->alert_strategy = $var; + + return $this; + } + + /** + * Optional. The severity of an alerting policy indicates how important + * incidents generated by that policy are. The severity level will be + * displayed on the Incident detail page and in notifications. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Severity severity = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Optional. The severity of an alerting policy indicates how important + * incidents generated by that policy are. The severity level will be + * displayed on the Incident detail page and in notifications. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Severity severity = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Severity::class); + $this->severity = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy.php new file mode 100644 index 000000000000..c8145f8e85af --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy.php @@ -0,0 +1,217 @@ +google.monitoring.v3.AlertPolicy.AlertStrategy + */ +class AlertStrategy extends \Google\Protobuf\Internal\Message +{ + /** + * Required for log-based alerting policies, i.e. policies with a `LogMatch` + * condition. + * This limit is not implemented for alerting policies that do not have + * a LogMatch condition. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit notification_rate_limit = 1; + */ + protected $notification_rate_limit = null; + /** + * For log-based alert policies, the notification prompts is always + * [OPENED]. For non log-based alert policies, the notification prompts can + * be [OPENED] or [OPENED, CLOSED]. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt notification_prompts = 2; + */ + private $notification_prompts; + /** + * If an alerting policy that was active has no data for this long, any open + * incidents will close + * + * Generated from protobuf field .google.protobuf.Duration auto_close = 3; + */ + protected $auto_close = null; + /** + * Control how notifications will be sent out, on a per-channel basis. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy notification_channel_strategy = 4; + */ + private $notification_channel_strategy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationRateLimit $notification_rate_limit + * Required for log-based alerting policies, i.e. policies with a `LogMatch` + * condition. + * This limit is not implemented for alerting policies that do not have + * a LogMatch condition. + * @type array|\Google\Protobuf\Internal\RepeatedField $notification_prompts + * For log-based alert policies, the notification prompts is always + * [OPENED]. For non log-based alert policies, the notification prompts can + * be [OPENED] or [OPENED, CLOSED]. + * @type \Google\Protobuf\Duration $auto_close + * If an alerting policy that was active has no data for this long, any open + * incidents will close + * @type array<\Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationChannelStrategy>|\Google\Protobuf\Internal\RepeatedField $notification_channel_strategy + * Control how notifications will be sent out, on a per-channel basis. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required for log-based alerting policies, i.e. policies with a `LogMatch` + * condition. + * This limit is not implemented for alerting policies that do not have + * a LogMatch condition. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit notification_rate_limit = 1; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationRateLimit|null + */ + public function getNotificationRateLimit() + { + return $this->notification_rate_limit; + } + + public function hasNotificationRateLimit() + { + return isset($this->notification_rate_limit); + } + + public function clearNotificationRateLimit() + { + unset($this->notification_rate_limit); + } + + /** + * Required for log-based alerting policies, i.e. policies with a `LogMatch` + * condition. + * This limit is not implemented for alerting policies that do not have + * a LogMatch condition. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit notification_rate_limit = 1; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationRateLimit $var + * @return $this + */ + public function setNotificationRateLimit($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationRateLimit::class); + $this->notification_rate_limit = $var; + + return $this; + } + + /** + * For log-based alert policies, the notification prompts is always + * [OPENED]. For non log-based alert policies, the notification prompts can + * be [OPENED] or [OPENED, CLOSED]. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt notification_prompts = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationPrompts() + { + return $this->notification_prompts; + } + + /** + * For log-based alert policies, the notification prompts is always + * [OPENED]. For non log-based alert policies, the notification prompts can + * be [OPENED] or [OPENED, CLOSED]. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt notification_prompts = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationPrompts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationPrompt::class); + $this->notification_prompts = $arr; + + return $this; + } + + /** + * If an alerting policy that was active has no data for this long, any open + * incidents will close + * + * Generated from protobuf field .google.protobuf.Duration auto_close = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getAutoClose() + { + return $this->auto_close; + } + + public function hasAutoClose() + { + return isset($this->auto_close); + } + + public function clearAutoClose() + { + unset($this->auto_close); + } + + /** + * If an alerting policy that was active has no data for this long, any open + * incidents will close + * + * Generated from protobuf field .google.protobuf.Duration auto_close = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setAutoClose($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->auto_close = $var; + + return $this; + } + + /** + * Control how notifications will be sent out, on a per-channel basis. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy notification_channel_strategy = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationChannelStrategy() + { + return $this->notification_channel_strategy; + } + + /** + * Control how notifications will be sent out, on a per-channel basis. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy notification_channel_strategy = 4; + * @param array<\Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationChannelStrategy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationChannelStrategy($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy\AlertStrategy\NotificationChannelStrategy::class); + $this->notification_channel_strategy = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AlertStrategy::class, \Google\Cloud\Monitoring\V3\AlertPolicy_AlertStrategy::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationChannelStrategy.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationChannelStrategy.php new file mode 100644 index 000000000000..3fb4be795892 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationChannelStrategy.php @@ -0,0 +1,139 @@ +google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy + */ +class NotificationChannelStrategy extends \Google\Protobuf\Internal\Message +{ + /** + * The full REST resource name for the notification channels that these + * settings apply to. Each of these correspond to the name field in one + * of the NotificationChannel objects referenced in the + * notification_channels field of this AlertPolicy. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channel_names = 1; + */ + private $notification_channel_names; + /** + * The frequency at which to send reminder notifications for open + * incidents. + * + * Generated from protobuf field .google.protobuf.Duration renotify_interval = 2; + */ + protected $renotify_interval = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $notification_channel_names + * The full REST resource name for the notification channels that these + * settings apply to. Each of these correspond to the name field in one + * of the NotificationChannel objects referenced in the + * notification_channels field of this AlertPolicy. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @type \Google\Protobuf\Duration $renotify_interval + * The frequency at which to send reminder notifications for open + * incidents. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * The full REST resource name for the notification channels that these + * settings apply to. Each of these correspond to the name field in one + * of the NotificationChannel objects referenced in the + * notification_channels field of this AlertPolicy. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channel_names = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationChannelNames() + { + return $this->notification_channel_names; + } + + /** + * The full REST resource name for the notification channels that these + * settings apply to. Each of these correspond to the name field in one + * of the NotificationChannel objects referenced in the + * notification_channels field of this AlertPolicy. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field repeated string notification_channel_names = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationChannelNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->notification_channel_names = $arr; + + return $this; + } + + /** + * The frequency at which to send reminder notifications for open + * incidents. + * + * Generated from protobuf field .google.protobuf.Duration renotify_interval = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getRenotifyInterval() + { + return $this->renotify_interval; + } + + public function hasRenotifyInterval() + { + return isset($this->renotify_interval); + } + + public function clearRenotifyInterval() + { + unset($this->renotify_interval); + } + + /** + * The frequency at which to send reminder notifications for open + * incidents. + * + * Generated from protobuf field .google.protobuf.Duration renotify_interval = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRenotifyInterval($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->renotify_interval = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NotificationChannelStrategy::class, \Google\Cloud\Monitoring\V3\AlertPolicy_AlertStrategy_NotificationChannelStrategy::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationPrompt.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationPrompt.php new file mode 100644 index 000000000000..c5cceba508af --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationPrompt.php @@ -0,0 +1,64 @@ +google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt + */ +class NotificationPrompt +{ + /** + * No strategy specified. Treated as error. + * + * Generated from protobuf enum NOTIFICATION_PROMPT_UNSPECIFIED = 0; + */ + const NOTIFICATION_PROMPT_UNSPECIFIED = 0; + /** + * Notify when an incident is opened. + * + * Generated from protobuf enum OPENED = 1; + */ + const OPENED = 1; + /** + * Notify when an incident is closed. + * + * Generated from protobuf enum CLOSED = 3; + */ + const CLOSED = 3; + + private static $valueToName = [ + self::NOTIFICATION_PROMPT_UNSPECIFIED => 'NOTIFICATION_PROMPT_UNSPECIFIED', + self::OPENED => 'OPENED', + self::CLOSED => 'CLOSED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NotificationPrompt::class, \Google\Cloud\Monitoring\V3\AlertPolicy_AlertStrategy_NotificationPrompt::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationRateLimit.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationRateLimit.php new file mode 100644 index 000000000000..24928f618e19 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/AlertStrategy/NotificationRateLimit.php @@ -0,0 +1,81 @@ +google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit + */ +class NotificationRateLimit extends \Google\Protobuf\Internal\Message +{ + /** + * Not more than one notification per `period`. + * + * Generated from protobuf field .google.protobuf.Duration period = 1; + */ + protected $period = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $period + * Not more than one notification per `period`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Not more than one notification per `period`. + * + * Generated from protobuf field .google.protobuf.Duration period = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getPeriod() + { + return $this->period; + } + + public function hasPeriod() + { + return isset($this->period); + } + + public function clearPeriod() + { + unset($this->period); + } + + /** + * Not more than one notification per `period`. + * + * Generated from protobuf field .google.protobuf.Duration period = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->period = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NotificationRateLimit::class, \Google\Cloud\Monitoring\V3\AlertPolicy_AlertStrategy_NotificationRateLimit::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition.php new file mode 100644 index 000000000000..424c8a6efb04 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition.php @@ -0,0 +1,406 @@ +google.monitoring.v3.AlertPolicy.Condition + */ +class Condition extends \Google\Protobuf\Internal\Message +{ + /** + * Required if the condition exists. The unique resource name for this + * condition. Its format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] + * `[CONDITION_ID]` is assigned by Cloud Monitoring when the + * condition is created as part of a new or updated alerting policy. + * When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the conditions of the + * requested alerting policy. Cloud Monitoring creates the + * condition identifiers and includes them in the new policy. + * When calling the + * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] + * method to update a policy, including a condition `name` causes the + * existing condition to be updated. Conditions without names are added to + * the updated policy. Existing conditions are deleted if they are not + * updated. + * Best practice is to preserve `[CONDITION_ID]` if you make only small + * changes, such as those to condition thresholds, durations, or trigger + * values. Otherwise, treat the change as a new condition and let the + * existing condition be deleted. + * + * Generated from protobuf field string name = 12; + */ + protected $name = ''; + /** + * A short name or phrase used to identify the condition in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple conditions in the same policy. + * + * Generated from protobuf field string display_name = 6; + */ + protected $display_name = ''; + protected $condition; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required if the condition exists. The unique resource name for this + * condition. Its format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] + * `[CONDITION_ID]` is assigned by Cloud Monitoring when the + * condition is created as part of a new or updated alerting policy. + * When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the conditions of the + * requested alerting policy. Cloud Monitoring creates the + * condition identifiers and includes them in the new policy. + * When calling the + * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] + * method to update a policy, including a condition `name` causes the + * existing condition to be updated. Conditions without names are added to + * the updated policy. Existing conditions are deleted if they are not + * updated. + * Best practice is to preserve `[CONDITION_ID]` if you make only small + * changes, such as those to condition thresholds, durations, or trigger + * values. Otherwise, treat the change as a new condition and let the + * existing condition be deleted. + * @type string $display_name + * A short name or phrase used to identify the condition in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple conditions in the same policy. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold $condition_threshold + * A condition that compares a time series against a threshold. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricAbsence $condition_absent + * A condition that checks that a time series continues to + * receive new data points. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\LogMatch $condition_matched_log + * A condition that checks for log messages matching given constraints. If + * set, no other conditions can be present. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MonitoringQueryLanguageCondition $condition_monitoring_query_language + * A condition that uses the Monitoring Query Language to define + * alerts. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\PrometheusQueryLanguageCondition $condition_prometheus_query_language + * A condition that uses the Prometheus query language to define alerts. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition $condition_sql + * A condition that periodically evaluates a SQL query result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required if the condition exists. The unique resource name for this + * condition. Its format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] + * `[CONDITION_ID]` is assigned by Cloud Monitoring when the + * condition is created as part of a new or updated alerting policy. + * When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the conditions of the + * requested alerting policy. Cloud Monitoring creates the + * condition identifiers and includes them in the new policy. + * When calling the + * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] + * method to update a policy, including a condition `name` causes the + * existing condition to be updated. Conditions without names are added to + * the updated policy. Existing conditions are deleted if they are not + * updated. + * Best practice is to preserve `[CONDITION_ID]` if you make only small + * changes, such as those to condition thresholds, durations, or trigger + * values. Otherwise, treat the change as a new condition and let the + * existing condition be deleted. + * + * Generated from protobuf field string name = 12; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required if the condition exists. The unique resource name for this + * condition. Its format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] + * `[CONDITION_ID]` is assigned by Cloud Monitoring when the + * condition is created as part of a new or updated alerting policy. + * When calling the + * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + * method, do not include the `name` field in the conditions of the + * requested alerting policy. Cloud Monitoring creates the + * condition identifiers and includes them in the new policy. + * When calling the + * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] + * method to update a policy, including a condition `name` causes the + * existing condition to be updated. Conditions without names are added to + * the updated policy. Existing conditions are deleted if they are not + * updated. + * Best practice is to preserve `[CONDITION_ID]` if you make only small + * changes, such as those to condition thresholds, durations, or trigger + * values. Otherwise, treat the change as a new condition and let the + * existing condition be deleted. + * + * Generated from protobuf field string name = 12; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A short name or phrase used to identify the condition in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple conditions in the same policy. + * + * Generated from protobuf field string display_name = 6; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A short name or phrase used to identify the condition in dashboards, + * notifications, and incidents. To avoid confusion, don't use the same + * display name for multiple conditions in the same policy. + * + * Generated from protobuf field string display_name = 6; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * A condition that compares a time series against a threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold|null + */ + public function getConditionThreshold() + { + return $this->readOneof(1); + } + + public function hasConditionThreshold() + { + return $this->hasOneof(1); + } + + /** + * A condition that compares a time series against a threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold $var + * @return $this + */ + public function setConditionThreshold($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A condition that checks that a time series continues to + * receive new data points. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricAbsence|null + */ + public function getConditionAbsent() + { + return $this->readOneof(2); + } + + public function hasConditionAbsent() + { + return $this->hasOneof(2); + } + + /** + * A condition that checks that a time series continues to + * receive new data points. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricAbsence $var + * @return $this + */ + public function setConditionAbsent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricAbsence::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A condition that checks for log messages matching given constraints. If + * set, no other conditions can be present. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.LogMatch condition_matched_log = 20; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\LogMatch|null + */ + public function getConditionMatchedLog() + { + return $this->readOneof(20); + } + + public function hasConditionMatchedLog() + { + return $this->hasOneof(20); + } + + /** + * A condition that checks for log messages matching given constraints. If + * set, no other conditions can be present. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.LogMatch condition_matched_log = 20; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\LogMatch $var + * @return $this + */ + public function setConditionMatchedLog($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\LogMatch::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * A condition that uses the Monitoring Query Language to define + * alerts. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition condition_monitoring_query_language = 19; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MonitoringQueryLanguageCondition|null + */ + public function getConditionMonitoringQueryLanguage() + { + return $this->readOneof(19); + } + + public function hasConditionMonitoringQueryLanguage() + { + return $this->hasOneof(19); + } + + /** + * A condition that uses the Monitoring Query Language to define + * alerts. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition condition_monitoring_query_language = 19; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MonitoringQueryLanguageCondition $var + * @return $this + */ + public function setConditionMonitoringQueryLanguage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MonitoringQueryLanguageCondition::class); + $this->writeOneof(19, $var); + + return $this; + } + + /** + * A condition that uses the Prometheus query language to define alerts. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition condition_prometheus_query_language = 21; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\PrometheusQueryLanguageCondition|null + */ + public function getConditionPrometheusQueryLanguage() + { + return $this->readOneof(21); + } + + public function hasConditionPrometheusQueryLanguage() + { + return $this->hasOneof(21); + } + + /** + * A condition that uses the Prometheus query language to define alerts. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition condition_prometheus_query_language = 21; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\PrometheusQueryLanguageCondition $var + * @return $this + */ + public function setConditionPrometheusQueryLanguage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\PrometheusQueryLanguageCondition::class); + $this->writeOneof(21, $var); + + return $this; + } + + /** + * A condition that periodically evaluates a SQL query result. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition condition_sql = 22; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition|null + */ + public function getConditionSql() + { + return $this->readOneof(22); + } + + public function hasConditionSql() + { + return $this->hasOneof(22); + } + + /** + * A condition that periodically evaluates a SQL query result. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition condition_sql = 22; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition $var + * @return $this + */ + public function setConditionSql($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition::class); + $this->writeOneof(22, $var); + + return $this; + } + + /** + * @return string + */ + public function getCondition() + { + return $this->whichOneof("condition"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Condition::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/EvaluationMissingData.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/EvaluationMissingData.php new file mode 100644 index 000000000000..6fc5a47b481b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/EvaluationMissingData.php @@ -0,0 +1,76 @@ +google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData + */ +class EvaluationMissingData +{ + /** + * An unspecified evaluation missing data option. Equivalent to + * EVALUATION_MISSING_DATA_NO_OP. + * + * Generated from protobuf enum EVALUATION_MISSING_DATA_UNSPECIFIED = 0; + */ + const EVALUATION_MISSING_DATA_UNSPECIFIED = 0; + /** + * If there is no data to evaluate the condition, then evaluate the + * condition as false. + * + * Generated from protobuf enum EVALUATION_MISSING_DATA_INACTIVE = 1; + */ + const EVALUATION_MISSING_DATA_INACTIVE = 1; + /** + * If there is no data to evaluate the condition, then evaluate the + * condition as true. + * + * Generated from protobuf enum EVALUATION_MISSING_DATA_ACTIVE = 2; + */ + const EVALUATION_MISSING_DATA_ACTIVE = 2; + /** + * Do not evaluate the condition to any value if there is no data. + * + * Generated from protobuf enum EVALUATION_MISSING_DATA_NO_OP = 3; + */ + const EVALUATION_MISSING_DATA_NO_OP = 3; + + private static $valueToName = [ + self::EVALUATION_MISSING_DATA_UNSPECIFIED => 'EVALUATION_MISSING_DATA_UNSPECIFIED', + self::EVALUATION_MISSING_DATA_INACTIVE => 'EVALUATION_MISSING_DATA_INACTIVE', + self::EVALUATION_MISSING_DATA_ACTIVE => 'EVALUATION_MISSING_DATA_ACTIVE', + self::EVALUATION_MISSING_DATA_NO_OP => 'EVALUATION_MISSING_DATA_NO_OP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EvaluationMissingData::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_EvaluationMissingData::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/LogMatch.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/LogMatch.php new file mode 100644 index 000000000000..cd52e655a016 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/LogMatch.php @@ -0,0 +1,151 @@ +google.monitoring.v3.AlertPolicy.Condition.LogMatch + */ +class LogMatch extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A logs-based filter. See [Advanced Logs + * Queries](https://cloud.google.com/logging/docs/view/advanced-queries) + * for how this filter should be constructed. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Optional. A map from a label key to an extractor expression, which is + * used to extract the value for this label key. Each entry in this map is + * a specification for how data should be extracted from log entries that + * match `filter`. Each combination of extracted values is treated as a + * separate rule for the purposes of triggering notifications. Label keys + * and corresponding values can be used in notifications generated by this + * condition. + * Please see [the documentation on logs-based metric + * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor) + * for syntax and examples. + * + * Generated from protobuf field map label_extractors = 2; + */ + private $label_extractors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * Required. A logs-based filter. See [Advanced Logs + * Queries](https://cloud.google.com/logging/docs/view/advanced-queries) + * for how this filter should be constructed. + * @type array|\Google\Protobuf\Internal\MapField $label_extractors + * Optional. A map from a label key to an extractor expression, which is + * used to extract the value for this label key. Each entry in this map is + * a specification for how data should be extracted from log entries that + * match `filter`. Each combination of extracted values is treated as a + * separate rule for the purposes of triggering notifications. Label keys + * and corresponding values can be used in notifications generated by this + * condition. + * Please see [the documentation on logs-based metric + * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor) + * for syntax and examples. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. A logs-based filter. See [Advanced Logs + * Queries](https://cloud.google.com/logging/docs/view/advanced-queries) + * for how this filter should be constructed. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A logs-based filter. See [Advanced Logs + * Queries](https://cloud.google.com/logging/docs/view/advanced-queries) + * for how this filter should be constructed. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. A map from a label key to an extractor expression, which is + * used to extract the value for this label key. Each entry in this map is + * a specification for how data should be extracted from log entries that + * match `filter`. Each combination of extracted values is treated as a + * separate rule for the purposes of triggering notifications. Label keys + * and corresponding values can be used in notifications generated by this + * condition. + * Please see [the documentation on logs-based metric + * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor) + * for syntax and examples. + * + * Generated from protobuf field map label_extractors = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabelExtractors() + { + return $this->label_extractors; + } + + /** + * Optional. A map from a label key to an extractor expression, which is + * used to extract the value for this label key. Each entry in this map is + * a specification for how data should be extracted from log entries that + * match `filter`. Each combination of extracted values is treated as a + * separate rule for the purposes of triggering notifications. Label keys + * and corresponding values can be used in notifications generated by this + * condition. + * Please see [the documentation on logs-based metric + * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor) + * for syntax and examples. + * + * Generated from protobuf field map label_extractors = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabelExtractors($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->label_extractors = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LogMatch::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_LogMatch::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricAbsence.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricAbsence.php new file mode 100644 index 000000000000..fc6aad1dfc46 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricAbsence.php @@ -0,0 +1,304 @@ +google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + */ +class MetricAbsence extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 5; + */ + private $aggregations; + /** + * The amount of time that a time series must fail to report new + * data to be considered failing. The minimum value of this field + * is 120 seconds. Larger values that are a multiple of a + * minute--for example, 240 or 300 seconds--are supported. + * If an invalid value is given, an + * error will be returned. The `Duration.nanos` field is + * ignored. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + */ + protected $trigger = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * @type array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $aggregations + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * @type \Google\Protobuf\Duration $duration + * The amount of time that a time series must fail to report new + * data to be considered failing. The minimum value of this field + * is 120 seconds. Larger values that are a multiple of a + * minute--for example, 240 or 300 seconds--are supported. + * If an invalid value is given, an + * error will be returned. The `Duration.nanos` field is + * ignored. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $trigger + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAggregations() + { + return $this->aggregations; + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 5; + * @param array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAggregations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Aggregation::class); + $this->aggregations = $arr; + + return $this; + } + + /** + * The amount of time that a time series must fail to report new + * data to be considered failing. The minimum value of this field + * is 120 seconds. Larger values that are a multiple of a + * minute--for example, 240 or 300 seconds--are supported. + * If an invalid value is given, an + * error will be returned. The `Duration.nanos` field is + * ignored. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * The amount of time that a time series must fail to report new + * data to be considered failing. The minimum value of this field + * is 120 seconds. Larger values that are a multiple of a + * minute--for example, 240 or 300 seconds--are supported. + * If an invalid value is given, an + * error will be returned. The `Duration.nanos` field is + * ignored. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger|null + */ + public function getTrigger() + { + return $this->trigger; + } + + public function hasTrigger() + { + return isset($this->trigger); + } + + public function clearTrigger() + { + unset($this->trigger); + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $var + * @return $this + */ + public function setTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger::class); + $this->trigger = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricAbsence::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricAbsence::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold.php new file mode 100644 index 000000000000..74e9099f57fc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold.php @@ -0,0 +1,635 @@ +google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + */ +class MetricThreshold extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 8; + */ + private $aggregations; + /** + * A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies a time series that should be used as the denominator of a + * ratio that will be compared with the threshold. If a + * `denominator_filter` is specified, the time series specified by the + * `filter` field will be used as the numerator. + * The filter must specify the metric type and optionally may contain + * restrictions on resource type, resource labels, and metric labels. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string denominator_filter = 9; + */ + protected $denominator_filter = ''; + /** + * Specifies the alignment of data points in individual time series + * selected by `denominatorFilter` as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). + * When computing ratios, the `aggregations` and + * `denominator_aggregations` fields must use the same alignment period + * and produce time series that have the same periodicity and labels. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10; + */ + private $denominator_aggregations; + /** + * When this field is present, the `MetricThreshold` condition forecasts + * whether the time series is predicted to violate the threshold within + * the `forecast_horizon`. When this field is not set, the + * `MetricThreshold` tests the current value of the timeseries against the + * threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions forecast_options = 12; + */ + protected $forecast_options = null; + /** + * The comparison to apply between the time series (indicated by `filter` + * and `aggregation`) and the threshold (indicated by `threshold_value`). + * The comparison is applied on each time series, with the time series + * on the left-hand side and the threshold on the right-hand side. + * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 4; + */ + protected $comparison = 0; + /** + * A value against which to compare the time series. + * + * Generated from protobuf field double threshold_value = 5; + */ + protected $threshold_value = 0.0; + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 6; + */ + protected $duration = null; + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7; + */ + protected $trigger = null; + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. To use this control, the value + * of the `duration` field must be greater than or equal to 60 seconds. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 11; + */ + protected $evaluation_missing_data = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * @type array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $aggregations + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * @type string $denominator_filter + * A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies a time series that should be used as the denominator of a + * ratio that will be compared with the threshold. If a + * `denominator_filter` is specified, the time series specified by the + * `filter` field will be used as the numerator. + * The filter must specify the metric type and optionally may contain + * restrictions on resource type, resource labels, and metric labels. + * This field may not exceed 2048 Unicode characters in length. + * @type array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $denominator_aggregations + * Specifies the alignment of data points in individual time series + * selected by `denominatorFilter` as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). + * When computing ratios, the `aggregations` and + * `denominator_aggregations` fields must use the same alignment period + * and produce time series that have the same periodicity and labels. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold\ForecastOptions $forecast_options + * When this field is present, the `MetricThreshold` condition forecasts + * whether the time series is predicted to violate the threshold within + * the `forecast_horizon`. When this field is not set, the + * `MetricThreshold` tests the current value of the timeseries against the + * threshold. + * @type int $comparison + * The comparison to apply between the time series (indicated by `filter` + * and `aggregation`) and the threshold (indicated by `threshold_value`). + * The comparison is applied on each time series, with the time series + * on the left-hand side and the threshold on the right-hand side. + * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. + * @type float $threshold_value + * A value against which to compare the time series. + * @type \Google\Protobuf\Duration $duration + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $trigger + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * @type int $evaluation_missing_data + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. To use this control, the value + * of the `duration` field must be greater than or equal to 60 seconds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A + * [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies which time series should be compared with the threshold. + * The filter is similar to the one that is specified in the + * [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + * (that call is useful to verify the time series that will be retrieved / + * processed). The filter must specify the metric type and the resource + * type. Optionally, it can specify resource labels and metric labels. + * This field must not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAggregations() + { + return $this->aggregations; + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). Multiple aggregations + * are applied in the order specified. + * This field is similar to the one in the [`ListTimeSeries` + * request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + * It is advisable to use the `ListTimeSeries` method when debugging this + * field. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation aggregations = 8; + * @param array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAggregations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Aggregation::class); + $this->aggregations = $arr; + + return $this; + } + + /** + * A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies a time series that should be used as the denominator of a + * ratio that will be compared with the threshold. If a + * `denominator_filter` is specified, the time series specified by the + * `filter` field will be used as the numerator. + * The filter must specify the metric type and optionally may contain + * restrictions on resource type, resource labels, and metric labels. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string denominator_filter = 9; + * @return string + */ + public function getDenominatorFilter() + { + return $this->denominator_filter; + } + + /** + * A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + * identifies a time series that should be used as the denominator of a + * ratio that will be compared with the threshold. If a + * `denominator_filter` is specified, the time series specified by the + * `filter` field will be used as the numerator. + * The filter must specify the metric type and optionally may contain + * restrictions on resource type, resource labels, and metric labels. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string denominator_filter = 9; + * @param string $var + * @return $this + */ + public function setDenominatorFilter($var) + { + GPBUtil::checkString($var, True); + $this->denominator_filter = $var; + + return $this; + } + + /** + * Specifies the alignment of data points in individual time series + * selected by `denominatorFilter` as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). + * When computing ratios, the `aggregations` and + * `denominator_aggregations` fields must use the same alignment period + * and produce time series that have the same periodicity and labels. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDenominatorAggregations() + { + return $this->denominator_aggregations; + } + + /** + * Specifies the alignment of data points in individual time series + * selected by `denominatorFilter` as + * well as how to combine the retrieved time series together (such as + * when aggregating multiple streams on each resource to a single + * stream for each resource or when aggregating streams across all + * members of a group of resources). + * When computing ratios, the `aggregations` and + * `denominator_aggregations` fields must use the same alignment period + * and produce time series that have the same periodicity and labels. + * + * Generated from protobuf field repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10; + * @param array<\Google\Cloud\Monitoring\V3\Aggregation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDenominatorAggregations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Aggregation::class); + $this->denominator_aggregations = $arr; + + return $this; + } + + /** + * When this field is present, the `MetricThreshold` condition forecasts + * whether the time series is predicted to violate the threshold within + * the `forecast_horizon`. When this field is not set, the + * `MetricThreshold` tests the current value of the timeseries against the + * threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions forecast_options = 12; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold\ForecastOptions|null + */ + public function getForecastOptions() + { + return $this->forecast_options; + } + + public function hasForecastOptions() + { + return isset($this->forecast_options); + } + + public function clearForecastOptions() + { + unset($this->forecast_options); + } + + /** + * When this field is present, the `MetricThreshold` condition forecasts + * whether the time series is predicted to violate the threshold within + * the `forecast_horizon`. When this field is not set, the + * `MetricThreshold` tests the current value of the timeseries against the + * threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions forecast_options = 12; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold\ForecastOptions $var + * @return $this + */ + public function setForecastOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold\ForecastOptions::class); + $this->forecast_options = $var; + + return $this; + } + + /** + * The comparison to apply between the time series (indicated by `filter` + * and `aggregation`) and the threshold (indicated by `threshold_value`). + * The comparison is applied on each time series, with the time series + * on the left-hand side and the threshold on the right-hand side. + * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 4; + * @return int + */ + public function getComparison() + { + return $this->comparison; + } + + /** + * The comparison to apply between the time series (indicated by `filter` + * and `aggregation`) and the threshold (indicated by `threshold_value`). + * The comparison is applied on each time series, with the time series + * on the left-hand side and the threshold on the right-hand side. + * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 4; + * @param int $var + * @return $this + */ + public function setComparison($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\ComparisonType::class); + $this->comparison = $var; + + return $this; + } + + /** + * A value against which to compare the time series. + * + * Generated from protobuf field double threshold_value = 5; + * @return float + */ + public function getThresholdValue() + { + return $this->threshold_value; + } + + /** + * A value against which to compare the time series. + * + * Generated from protobuf field double threshold_value = 5; + * @param float $var + * @return $this + */ + public function setThresholdValue($var) + { + GPBUtil::checkDouble($var); + $this->threshold_value = $var; + + return $this; + } + + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 6; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 6; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger|null + */ + public function getTrigger() + { + return $this->trigger; + } + + public function hasTrigger() + { + return isset($this->trigger); + } + + public function clearTrigger() + { + unset($this->trigger); + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $var + * @return $this + */ + public function setTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger::class); + $this->trigger = $var; + + return $this; + } + + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. To use this control, the value + * of the `duration` field must be greater than or equal to 60 seconds. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 11; + * @return int + */ + public function getEvaluationMissingData() + { + return $this->evaluation_missing_data; + } + + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. To use this control, the value + * of the `duration` field must be greater than or equal to 60 seconds. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 11; + * @param int $var + * @return $this + */ + public function setEvaluationMissingData($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\EvaluationMissingData::class); + $this->evaluation_missing_data = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricThreshold::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricThreshold::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold/ForecastOptions.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold/ForecastOptions.php new file mode 100644 index 000000000000..5b730b5b812c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MetricThreshold/ForecastOptions.php @@ -0,0 +1,101 @@ +google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions + */ +class ForecastOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The length of time into the future to forecast whether a + * time series will violate the threshold. If the predicted value is + * found to violate the threshold, and the violation is observed in all + * forecasts made for the configured `duration`, then the time series is + * considered to be failing. + * The forecast horizon can range from 1 hour to 60 hours. + * + * Generated from protobuf field .google.protobuf.Duration forecast_horizon = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $forecast_horizon = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $forecast_horizon + * Required. The length of time into the future to forecast whether a + * time series will violate the threshold. If the predicted value is + * found to violate the threshold, and the violation is observed in all + * forecasts made for the configured `duration`, then the time series is + * considered to be failing. + * The forecast horizon can range from 1 hour to 60 hours. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The length of time into the future to forecast whether a + * time series will violate the threshold. If the predicted value is + * found to violate the threshold, and the violation is observed in all + * forecasts made for the configured `duration`, then the time series is + * considered to be failing. + * The forecast horizon can range from 1 hour to 60 hours. + * + * Generated from protobuf field .google.protobuf.Duration forecast_horizon = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getForecastHorizon() + { + return $this->forecast_horizon; + } + + public function hasForecastHorizon() + { + return isset($this->forecast_horizon); + } + + public function clearForecastHorizon() + { + unset($this->forecast_horizon); + } + + /** + * Required. The length of time into the future to forecast whether a + * time series will violate the threshold. If the predicted value is + * found to violate the threshold, and the violation is observed in all + * forecasts made for the configured `duration`, then the time series is + * considered to be failing. + * The forecast horizon can range from 1 hour to 60 hours. + * + * Generated from protobuf field .google.protobuf.Duration forecast_horizon = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setForecastHorizon($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->forecast_horizon = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ForecastOptions::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricThreshold_ForecastOptions::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MonitoringQueryLanguageCondition.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MonitoringQueryLanguageCondition.php new file mode 100644 index 000000000000..22bb059fe5b0 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/MonitoringQueryLanguageCondition.php @@ -0,0 +1,257 @@ +google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + */ +class MonitoringQueryLanguageCondition extends \Google\Protobuf\Internal\Message +{ + /** + * [Monitoring Query Language](https://cloud.google.com/monitoring/mql) + * query that outputs a boolean stream. + * + * Generated from protobuf field string query = 1; + */ + protected $query = ''; + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + */ + protected $trigger = null; + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 4; + */ + protected $evaluation_missing_data = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $query + * [Monitoring Query Language](https://cloud.google.com/monitoring/mql) + * query that outputs a boolean stream. + * @type \Google\Protobuf\Duration $duration + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $trigger + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * @type int $evaluation_missing_data + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * [Monitoring Query Language](https://cloud.google.com/monitoring/mql) + * query that outputs a boolean stream. + * + * Generated from protobuf field string query = 1; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * [Monitoring Query Language](https://cloud.google.com/monitoring/mql) + * query that outputs a boolean stream. + * + * Generated from protobuf field string query = 1; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * The amount of time that a time series must violate the + * threshold to be considered failing. Currently, only values + * that are a multiple of a minute--e.g., 0, 60, 120, or 300 + * seconds--are supported. If an invalid value is given, an + * error will be returned. When choosing a duration, it is useful to + * keep in mind the frequency of the underlying time series data + * (which may also be affected by any alignments specified in the + * `aggregations` field); a good duration is long enough so that a single + * outlier does not generate spurious alerts, but short enough that + * unhealthy states are detected and alerted on quickly. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger|null + */ + public function getTrigger() + { + return $this->trigger; + } + + public function hasTrigger() + { + return isset($this->trigger); + } + + public function clearTrigger() + { + unset($this->trigger); + } + + /** + * The number/percent of time series for which the comparison must hold + * in order for the condition to trigger. If unspecified, then the + * condition will trigger if the comparison is true for any of the + * time series that have been identified by `filter` and `aggregations`, + * or by the ratio, if `denominator_filter` and `denominator_aggregations` + * are specified. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger $var + * @return $this + */ + public function setTrigger($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\Trigger::class); + $this->trigger = $var; + + return $this; + } + + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 4; + * @return int + */ + public function getEvaluationMissingData() + { + return $this->evaluation_missing_data; + } + + /** + * A condition control that determines how metric-threshold conditions + * are evaluated when data stops arriving. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData evaluation_missing_data = 4; + * @param int $var + * @return $this + */ + public function setEvaluationMissingData($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\EvaluationMissingData::class); + $this->evaluation_missing_data = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MonitoringQueryLanguageCondition::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MonitoringQueryLanguageCondition::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/PrometheusQueryLanguageCondition.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/PrometheusQueryLanguageCondition.php new file mode 100644 index 000000000000..a35357c0377f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/PrometheusQueryLanguageCondition.php @@ -0,0 +1,491 @@ +google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition + */ +class PrometheusQueryLanguageCondition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The PromQL expression to evaluate. Every evaluation cycle + * this expression is evaluated at the current time, and all resultant + * time series become pending/firing alerts. This field must not be empty. + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + /** + * Optional. Alerts are considered firing once their PromQL expression was + * evaluated to be "true" for this long. + * Alerts whose PromQL expression was not evaluated to be "true" for + * long enough are considered pending. + * Must be a non-negative duration or missing. + * This field is optional. Its default value is zero. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $duration = null; + /** + * Optional. How often this rule should be evaluated. + * Must be a positive multiple of 30 seconds or missing. + * This field is optional. Its default value is 30 seconds. + * If this PrometheusQueryLanguageCondition was generated from a + * Prometheus alerting rule, then this value should be taken from the + * enclosing rule group. + * + * Generated from protobuf field .google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $evaluation_interval = null; + /** + * Optional. Labels to add to or overwrite in the PromQL query result. + * Label names [must be + * valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * Label values can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * The only available variable names are the names of the labels in the + * PromQL result, including "__name__" and "value". "labels" may be empty. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. The rule group name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must + * contain a valid UTF-8 string. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rule_group = ''; + /** + * Optional. The alerting rule name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must be a + * [valid Prometheus label + * name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $alert_rule = ''; + /** + * Optional. Whether to disable metric existence validation for this + * condition. + * This allows alerting policies to be defined on metrics that do not yet + * exist, improving advanced customer workflows such as configuring + * alerting policies using Terraform. + * Users with the `monitoring.alertPolicyViewer` role are able to see the + * name of the non-existent metric in the alerting policy condition. + * + * Generated from protobuf field bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $disable_metric_validation = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $query + * Required. The PromQL expression to evaluate. Every evaluation cycle + * this expression is evaluated at the current time, and all resultant + * time series become pending/firing alerts. This field must not be empty. + * @type \Google\Protobuf\Duration $duration + * Optional. Alerts are considered firing once their PromQL expression was + * evaluated to be "true" for this long. + * Alerts whose PromQL expression was not evaluated to be "true" for + * long enough are considered pending. + * Must be a non-negative duration or missing. + * This field is optional. Its default value is zero. + * @type \Google\Protobuf\Duration $evaluation_interval + * Optional. How often this rule should be evaluated. + * Must be a positive multiple of 30 seconds or missing. + * This field is optional. Its default value is 30 seconds. + * If this PrometheusQueryLanguageCondition was generated from a + * Prometheus alerting rule, then this value should be taken from the + * enclosing rule group. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. Labels to add to or overwrite in the PromQL query result. + * Label names [must be + * valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * Label values can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * The only available variable names are the names of the labels in the + * PromQL result, including "__name__" and "value". "labels" may be empty. + * @type string $rule_group + * Optional. The rule group name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must + * contain a valid UTF-8 string. + * This field may not exceed 2048 Unicode characters in length. + * @type string $alert_rule + * Optional. The alerting rule name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must be a + * [valid Prometheus label + * name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * This field may not exceed 2048 Unicode characters in length. + * @type bool $disable_metric_validation + * Optional. Whether to disable metric existence validation for this + * condition. + * This allows alerting policies to be defined on metrics that do not yet + * exist, improving advanced customer workflows such as configuring + * alerting policies using Terraform. + * Users with the `monitoring.alertPolicyViewer` role are able to see the + * name of the non-existent metric in the alerting policy condition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The PromQL expression to evaluate. Every evaluation cycle + * this expression is evaluated at the current time, and all resultant + * time series become pending/firing alerts. This field must not be empty. + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. The PromQL expression to evaluate. Every evaluation cycle + * this expression is evaluated at the current time, and all resultant + * time series become pending/firing alerts. This field must not be empty. + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * Optional. Alerts are considered firing once their PromQL expression was + * evaluated to be "true" for this long. + * Alerts whose PromQL expression was not evaluated to be "true" for + * long enough are considered pending. + * Must be a non-negative duration or missing. + * This field is optional. Its default value is zero. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Optional. Alerts are considered firing once their PromQL expression was + * evaluated to be "true" for this long. + * Alerts whose PromQL expression was not evaluated to be "true" for + * long enough are considered pending. + * Must be a non-negative duration or missing. + * This field is optional. Its default value is zero. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Optional. How often this rule should be evaluated. + * Must be a positive multiple of 30 seconds or missing. + * This field is optional. Its default value is 30 seconds. + * If this PrometheusQueryLanguageCondition was generated from a + * Prometheus alerting rule, then this value should be taken from the + * enclosing rule group. + * + * Generated from protobuf field .google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getEvaluationInterval() + { + return $this->evaluation_interval; + } + + public function hasEvaluationInterval() + { + return isset($this->evaluation_interval); + } + + public function clearEvaluationInterval() + { + unset($this->evaluation_interval); + } + + /** + * Optional. How often this rule should be evaluated. + * Must be a positive multiple of 30 seconds or missing. + * This field is optional. Its default value is 30 seconds. + * If this PrometheusQueryLanguageCondition was generated from a + * Prometheus alerting rule, then this value should be taken from the + * enclosing rule group. + * + * Generated from protobuf field .google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEvaluationInterval($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->evaluation_interval = $var; + + return $this; + } + + /** + * Optional. Labels to add to or overwrite in the PromQL query result. + * Label names [must be + * valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * Label values can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * The only available variable names are the names of the labels in the + * PromQL result, including "__name__" and "value". "labels" may be empty. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. Labels to add to or overwrite in the PromQL query result. + * Label names [must be + * valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * Label values can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * The only available variable names are the names of the labels in the + * PromQL result, including "__name__" and "value". "labels" may be empty. + * + * Generated from protobuf field map labels = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. The rule group name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must + * contain a valid UTF-8 string. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRuleGroup() + { + return $this->rule_group; + } + + /** + * Optional. The rule group name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must + * contain a valid UTF-8 string. + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRuleGroup($var) + { + GPBUtil::checkString($var, True); + $this->rule_group = $var; + + return $this; + } + + /** + * Optional. The alerting rule name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must be a + * [valid Prometheus label + * name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAlertRule() + { + return $this->alert_rule; + } + + /** + * Optional. The alerting rule name of this alert in the corresponding + * Prometheus configuration file. + * Some external tools may require this field to be populated correctly + * in order to refer to the original Prometheus configuration file. + * The rule group name and the alert name are necessary to update the + * relevant AlertPolicies in case the definition of the rule group changes + * in the future. + * This field is optional. If this field is not empty, then it must be a + * [valid Prometheus label + * name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). + * This field may not exceed 2048 Unicode characters in length. + * + * Generated from protobuf field string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAlertRule($var) + { + GPBUtil::checkString($var, True); + $this->alert_rule = $var; + + return $this; + } + + /** + * Optional. Whether to disable metric existence validation for this + * condition. + * This allows alerting policies to be defined on metrics that do not yet + * exist, improving advanced customer workflows such as configuring + * alerting policies using Terraform. + * Users with the `monitoring.alertPolicyViewer` role are able to see the + * name of the non-existent metric in the alerting policy condition. + * + * Generated from protobuf field bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getDisableMetricValidation() + { + return $this->disable_metric_validation; + } + + /** + * Optional. Whether to disable metric existence validation for this + * condition. + * This allows alerting policies to be defined on metrics that do not yet + * exist, improving advanced customer workflows such as configuring + * alerting policies using Terraform. + * Users with the `monitoring.alertPolicyViewer` role are able to see the + * name of the non-existent metric in the alerting policy condition. + * + * Generated from protobuf field bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setDisableMetricValidation($var) + { + GPBUtil::checkBool($var); + $this->disable_metric_validation = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PrometheusQueryLanguageCondition::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_PrometheusQueryLanguageCondition::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition.php new file mode 100644 index 000000000000..e04212f27c57 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition.php @@ -0,0 +1,303 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition + */ +class SqlCondition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Log Analytics SQL query to run, as a string. The query + * must conform to the required shape. Specifically, the query must not + * try to filter the input by time. A filter will automatically be + * applied to filter the input so that the query receives all rows + * received since the last time the query was run. + * For example, the following query extracts all log entries containing an + * HTTP request: + * SELECT + * timestamp, log_name, severity, http_request, resource, labels + * FROM + * my-project.global._Default._AllLogs + * WHERE + * http_request IS NOT NULL + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + protected $schedule; + protected $evaluate; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $query + * Required. The Log Analytics SQL query to run, as a string. The query + * must conform to the required shape. Specifically, the query must not + * try to filter the input by time. A filter will automatically be + * applied to filter the input so that the query receives all rows + * received since the last time the query was run. + * For example, the following query extracts all log entries containing an + * HTTP request: + * SELECT + * timestamp, log_name, severity, http_request, resource, labels + * FROM + * my-project.global._Default._AllLogs + * WHERE + * http_request IS NOT NULL + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Minutes $minutes + * Schedule the query to execute every so many minutes. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Hourly $hourly + * Schedule the query to execute every so many hours. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Daily $daily + * Schedule the query to execute every so many days. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\RowCountTest $row_count_test + * Test the row count against a threshold. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\BooleanTest $boolean_test + * Test the boolean value in the indicated column. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Log Analytics SQL query to run, as a string. The query + * must conform to the required shape. Specifically, the query must not + * try to filter the input by time. A filter will automatically be + * applied to filter the input so that the query receives all rows + * received since the last time the query was run. + * For example, the following query extracts all log entries containing an + * HTTP request: + * SELECT + * timestamp, log_name, severity, http_request, resource, labels + * FROM + * my-project.global._Default._AllLogs + * WHERE + * http_request IS NOT NULL + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. The Log Analytics SQL query to run, as a string. The query + * must conform to the required shape. Specifically, the query must not + * try to filter the input by time. A filter will automatically be + * applied to filter the input so that the query receives all rows + * received since the last time the query was run. + * For example, the following query extracts all log entries containing an + * HTTP request: + * SELECT + * timestamp, log_name, severity, http_request, resource, labels + * FROM + * my-project.global._Default._AllLogs + * WHERE + * http_request IS NOT NULL + * + * Generated from protobuf field string query = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * Schedule the query to execute every so many minutes. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes minutes = 2; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Minutes|null + */ + public function getMinutes() + { + return $this->readOneof(2); + } + + public function hasMinutes() + { + return $this->hasOneof(2); + } + + /** + * Schedule the query to execute every so many minutes. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes minutes = 2; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Minutes $var + * @return $this + */ + public function setMinutes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Minutes::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Schedule the query to execute every so many hours. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly hourly = 3; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Hourly|null + */ + public function getHourly() + { + return $this->readOneof(3); + } + + public function hasHourly() + { + return $this->hasOneof(3); + } + + /** + * Schedule the query to execute every so many hours. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly hourly = 3; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Hourly $var + * @return $this + */ + public function setHourly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Hourly::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Schedule the query to execute every so many days. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily daily = 4; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Daily|null + */ + public function getDaily() + { + return $this->readOneof(4); + } + + public function hasDaily() + { + return $this->hasOneof(4); + } + + /** + * Schedule the query to execute every so many days. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily daily = 4; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Daily $var + * @return $this + */ + public function setDaily($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\Daily::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Test the row count against a threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest row_count_test = 5; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\RowCountTest|null + */ + public function getRowCountTest() + { + return $this->readOneof(5); + } + + public function hasRowCountTest() + { + return $this->hasOneof(5); + } + + /** + * Test the row count against a threshold. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest row_count_test = 5; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\RowCountTest $var + * @return $this + */ + public function setRowCountTest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\RowCountTest::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Test the boolean value in the indicated column. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest boolean_test = 6; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\BooleanTest|null + */ + public function getBooleanTest() + { + return $this->readOneof(6); + } + + public function hasBooleanTest() + { + return $this->hasOneof(6); + } + + /** + * Test the boolean value in the indicated column. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest boolean_test = 6; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\BooleanTest $var + * @return $this + */ + public function setBooleanTest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\SqlCondition\BooleanTest::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getSchedule() + { + return $this->whichOneof("schedule"); + } + + /** + * @return string + */ + public function getEvaluate() + { + return $this->whichOneof("evaluate"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SqlCondition::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/BooleanTest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/BooleanTest.php new file mode 100644 index 000000000000..f3201e398e6b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/BooleanTest.php @@ -0,0 +1,75 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest + */ +class BooleanTest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the column containing the boolean value. If the + * value in a row is NULL, that row is ignored. + * + * Generated from protobuf field string column = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $column = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $column + * Required. The name of the column containing the boolean value. If the + * value in a row is NULL, that row is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the column containing the boolean value. If the + * value in a row is NULL, that row is ignored. + * + * Generated from protobuf field string column = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getColumn() + { + return $this->column; + } + + /** + * Required. The name of the column containing the boolean value. If the + * value in a row is NULL, that row is ignored. + * + * Generated from protobuf field string column = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkString($var, True); + $this->column = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BooleanTest::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition_BooleanTest::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Daily.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Daily.php new file mode 100644 index 000000000000..bc3e1df46a54 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Daily.php @@ -0,0 +1,126 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily + */ +class Daily extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The number of days between runs. Must be greater than or + * equal to 1 day and less than or equal to 31 days. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $periodicity = 0; + /** + * Optional. The time of day (in UTC) at which the query should run. If + * left unspecified, the server picks an arbitrary time of day and runs + * the query at the same time each day. + * + * Generated from protobuf field .google.type.TimeOfDay execution_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $execution_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $periodicity + * Required. The number of days between runs. Must be greater than or + * equal to 1 day and less than or equal to 31 days. + * @type \Google\Type\TimeOfDay $execution_time + * Optional. The time of day (in UTC) at which the query should run. If + * left unspecified, the server picks an arbitrary time of day and runs + * the query at the same time each day. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The number of days between runs. Must be greater than or + * equal to 1 day and less than or equal to 31 days. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPeriodicity() + { + return $this->periodicity; + } + + /** + * Required. The number of days between runs. Must be greater than or + * equal to 1 day and less than or equal to 31 days. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPeriodicity($var) + { + GPBUtil::checkInt32($var); + $this->periodicity = $var; + + return $this; + } + + /** + * Optional. The time of day (in UTC) at which the query should run. If + * left unspecified, the server picks an arbitrary time of day and runs + * the query at the same time each day. + * + * Generated from protobuf field .google.type.TimeOfDay execution_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Type\TimeOfDay|null + */ + public function getExecutionTime() + { + return $this->execution_time; + } + + public function hasExecutionTime() + { + return isset($this->execution_time); + } + + public function clearExecutionTime() + { + unset($this->execution_time); + } + + /** + * Optional. The time of day (in UTC) at which the query should run. If + * left unspecified, the server picks an arbitrary time of day and runs + * the query at the same time each day. + * + * Generated from protobuf field .google.type.TimeOfDay execution_time = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Type\TimeOfDay $var + * @return $this + */ + public function setExecutionTime($var) + { + GPBUtil::checkMessage($var, \Google\Type\TimeOfDay::class); + $this->execution_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Daily::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition_Daily::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Hourly.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Hourly.php new file mode 100644 index 000000000000..bd6e550132e0 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Hourly.php @@ -0,0 +1,130 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly + */ +class Hourly extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The number of hours between runs. Must be greater than or + * equal to 1 hour and less than or equal to 48 hours. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $periodicity = 0; + /** + * Optional. The number of minutes after the hour (in UTC) to run the + * query. Must be greater than or equal to 0 minutes and less than or + * equal to 59 minutes. If left unspecified, then an arbitrary offset + * is used. + * + * Generated from protobuf field optional int32 minute_offset = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $minute_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $periodicity + * Required. The number of hours between runs. Must be greater than or + * equal to 1 hour and less than or equal to 48 hours. + * @type int $minute_offset + * Optional. The number of minutes after the hour (in UTC) to run the + * query. Must be greater than or equal to 0 minutes and less than or + * equal to 59 minutes. If left unspecified, then an arbitrary offset + * is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The number of hours between runs. Must be greater than or + * equal to 1 hour and less than or equal to 48 hours. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPeriodicity() + { + return $this->periodicity; + } + + /** + * Required. The number of hours between runs. Must be greater than or + * equal to 1 hour and less than or equal to 48 hours. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPeriodicity($var) + { + GPBUtil::checkInt32($var); + $this->periodicity = $var; + + return $this; + } + + /** + * Optional. The number of minutes after the hour (in UTC) to run the + * query. Must be greater than or equal to 0 minutes and less than or + * equal to 59 minutes. If left unspecified, then an arbitrary offset + * is used. + * + * Generated from protobuf field optional int32 minute_offset = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMinuteOffset() + { + return isset($this->minute_offset) ? $this->minute_offset : 0; + } + + public function hasMinuteOffset() + { + return isset($this->minute_offset); + } + + public function clearMinuteOffset() + { + unset($this->minute_offset); + } + + /** + * Optional. The number of minutes after the hour (in UTC) to run the + * query. Must be greater than or equal to 0 minutes and less than or + * equal to 59 minutes. If left unspecified, then an arbitrary offset + * is used. + * + * Generated from protobuf field optional int32 minute_offset = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMinuteOffset($var) + { + GPBUtil::checkInt32($var); + $this->minute_offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Hourly::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition_Hourly::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Minutes.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Minutes.php new file mode 100644 index 000000000000..dacff07a3458 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/Minutes.php @@ -0,0 +1,78 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes + */ +class Minutes extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Number of minutes between runs. The interval must be + * greater than or equal to 5 minutes and less than or equal to 1440 + * minutes. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $periodicity = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $periodicity + * Required. Number of minutes between runs. The interval must be + * greater than or equal to 5 minutes and less than or equal to 1440 + * minutes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. Number of minutes between runs. The interval must be + * greater than or equal to 5 minutes and less than or equal to 1440 + * minutes. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPeriodicity() + { + return $this->periodicity; + } + + /** + * Required. Number of minutes between runs. The interval must be + * greater than or equal to 5 minutes and less than or equal to 1440 + * minutes. + * + * Generated from protobuf field int32 periodicity = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPeriodicity($var) + { + GPBUtil::checkInt32($var); + $this->periodicity = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Minutes::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition_Minutes::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/RowCountTest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/RowCountTest.php new file mode 100644 index 000000000000..033006775a06 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/SqlCondition/RowCountTest.php @@ -0,0 +1,109 @@ +google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest + */ +class RowCountTest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The comparison to apply between the number of rows returned + * by the query and the threshold. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $comparison = 0; + /** + * Required. The value against which to compare the row count. + * + * Generated from protobuf field int64 threshold = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $threshold = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $comparison + * Required. The comparison to apply between the number of rows returned + * by the query and the threshold. + * @type int|string $threshold + * Required. The value against which to compare the row count. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * Required. The comparison to apply between the number of rows returned + * by the query and the threshold. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getComparison() + { + return $this->comparison; + } + + /** + * Required. The comparison to apply between the number of rows returned + * by the query and the threshold. + * + * Generated from protobuf field .google.monitoring.v3.ComparisonType comparison = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setComparison($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\ComparisonType::class); + $this->comparison = $var; + + return $this; + } + + /** + * Required. The value against which to compare the row count. + * + * Generated from protobuf field int64 threshold = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int|string + */ + public function getThreshold() + { + return $this->threshold; + } + + /** + * Required. The value against which to compare the row count. + * + * Generated from protobuf field int64 threshold = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int|string $var + * @return $this + */ + public function setThreshold($var) + { + GPBUtil::checkInt64($var); + $this->threshold = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RowCountTest::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_SqlCondition_RowCountTest::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/Trigger.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/Trigger.php new file mode 100644 index 000000000000..8daaca29380f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Condition/Trigger.php @@ -0,0 +1,118 @@ +google.monitoring.v3.AlertPolicy.Condition.Trigger + */ +class Trigger extends \Google\Protobuf\Internal\Message +{ + protected $type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $count + * The absolute number of time series that must fail + * the predicate for the condition to be triggered. + * @type float $percent + * The percentage of time series that must fail the + * predicate for the condition to be triggered. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * The absolute number of time series that must fail + * the predicate for the condition to be triggered. + * + * Generated from protobuf field int32 count = 1; + * @return int + */ + public function getCount() + { + return $this->readOneof(1); + } + + public function hasCount() + { + return $this->hasOneof(1); + } + + /** + * The absolute number of time series that must fail + * the predicate for the condition to be triggered. + * + * Generated from protobuf field int32 count = 1; + * @param int $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The percentage of time series that must fail the + * predicate for the condition to be triggered. + * + * Generated from protobuf field double percent = 2; + * @return float + */ + public function getPercent() + { + return $this->readOneof(2); + } + + public function hasPercent() + { + return $this->hasOneof(2); + } + + /** + * The percentage of time series that must fail the + * predicate for the condition to be triggered. + * + * Generated from protobuf field double percent = 2; + * @param float $var + * @return $this + */ + public function setPercent($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->whichOneof("type"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Trigger::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_Trigger::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/ConditionCombinerType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/ConditionCombinerType.php new file mode 100644 index 000000000000..bb9e016f4bd9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/ConditionCombinerType.php @@ -0,0 +1,81 @@ +google.monitoring.v3.AlertPolicy.ConditionCombinerType + */ +class ConditionCombinerType +{ + /** + * An unspecified combiner. + * + * Generated from protobuf enum COMBINE_UNSPECIFIED = 0; + */ + const COMBINE_UNSPECIFIED = 0; + /** + * Combine conditions using the logical `AND` operator. An + * incident is created only if all the conditions are met + * simultaneously. This combiner is satisfied if all conditions are + * met, even if they are met on completely different resources. + * + * Generated from protobuf enum AND = 1; + */ + const PBAND = 1; + /** + * Combine conditions using the logical `OR` operator. An incident + * is created if any of the listed conditions is met. + * + * Generated from protobuf enum OR = 2; + */ + const PBOR = 2; + /** + * Combine conditions using logical `AND` operator, but unlike the regular + * `AND` option, an incident is created only if all conditions are met + * simultaneously on at least one resource. + * + * Generated from protobuf enum AND_WITH_MATCHING_RESOURCE = 3; + */ + const AND_WITH_MATCHING_RESOURCE = 3; + + private static $valueToName = [ + self::COMBINE_UNSPECIFIED => 'COMBINE_UNSPECIFIED', + self::PBAND => 'AND', + self::PBOR => 'OR', + self::AND_WITH_MATCHING_RESOURCE => 'AND_WITH_MATCHING_RESOURCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConditionCombinerType::class, \Google\Cloud\Monitoring\V3\AlertPolicy_ConditionCombinerType::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation.php new file mode 100644 index 000000000000..19c93b5e2dff --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation.php @@ -0,0 +1,245 @@ +google.monitoring.v3.AlertPolicy.Documentation + */ +class Documentation extends \Google\Protobuf\Internal\Message +{ + /** + * The body of the documentation, interpreted according to `mime_type`. + * The content may not exceed 8,192 Unicode characters and may not exceed + * more than 10,240 bytes when encoded in UTF-8 format, whichever is + * smaller. This text can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * + * Generated from protobuf field string content = 1; + */ + protected $content = ''; + /** + * The format of the `content` field. Presently, only the value + * `"text/markdown"` is supported. See + * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + /** + * Optional. The subject line of the notification. The subject line may not + * exceed 10,240 bytes. In notifications generated by this policy, the + * contents of the subject line after variable expansion will be truncated + * to 255 bytes or shorter at the latest UTF-8 character boundary. The + * 255-byte limit is recommended by [this + * thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit). + * It is both the limit imposed by some third-party ticketing products and + * it is common to define textual fields in databases as VARCHAR(255). + * The contents of the subject line can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * If this field is missing or empty, a default subject line will be + * generated. + * + * Generated from protobuf field string subject = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $subject = ''; + /** + * Optional. Links to content such as playbooks, repositories, and other + * resources. This field can contain up to 3 entries. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Documentation.Link links = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $links; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * The body of the documentation, interpreted according to `mime_type`. + * The content may not exceed 8,192 Unicode characters and may not exceed + * more than 10,240 bytes when encoded in UTF-8 format, whichever is + * smaller. This text can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * @type string $mime_type + * The format of the `content` field. Presently, only the value + * `"text/markdown"` is supported. See + * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. + * @type string $subject + * Optional. The subject line of the notification. The subject line may not + * exceed 10,240 bytes. In notifications generated by this policy, the + * contents of the subject line after variable expansion will be truncated + * to 255 bytes or shorter at the latest UTF-8 character boundary. The + * 255-byte limit is recommended by [this + * thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit). + * It is both the limit imposed by some third-party ticketing products and + * it is common to define textual fields in databases as VARCHAR(255). + * The contents of the subject line can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * If this field is missing or empty, a default subject line will be + * generated. + * @type array<\Google\Cloud\Monitoring\V3\AlertPolicy\Documentation\Link>|\Google\Protobuf\Internal\RepeatedField $links + * Optional. Links to content such as playbooks, repositories, and other + * resources. This field can contain up to 3 entries. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * The body of the documentation, interpreted according to `mime_type`. + * The content may not exceed 8,192 Unicode characters and may not exceed + * more than 10,240 bytes when encoded in UTF-8 format, whichever is + * smaller. This text can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The body of the documentation, interpreted according to `mime_type`. + * The content may not exceed 8,192 Unicode characters and may not exceed + * more than 10,240 bytes when encoded in UTF-8 format, whichever is + * smaller. This text can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * The format of the `content` field. Presently, only the value + * `"text/markdown"` is supported. See + * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The format of the `content` field. Presently, only the value + * `"text/markdown"` is supported. See + * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. The subject line of the notification. The subject line may not + * exceed 10,240 bytes. In notifications generated by this policy, the + * contents of the subject line after variable expansion will be truncated + * to 255 bytes or shorter at the latest UTF-8 character boundary. The + * 255-byte limit is recommended by [this + * thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit). + * It is both the limit imposed by some third-party ticketing products and + * it is common to define textual fields in databases as VARCHAR(255). + * The contents of the subject line can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * If this field is missing or empty, a default subject line will be + * generated. + * + * Generated from protobuf field string subject = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Optional. The subject line of the notification. The subject line may not + * exceed 10,240 bytes. In notifications generated by this policy, the + * contents of the subject line after variable expansion will be truncated + * to 255 bytes or shorter at the latest UTF-8 character boundary. The + * 255-byte limit is recommended by [this + * thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit). + * It is both the limit imposed by some third-party ticketing products and + * it is common to define textual fields in databases as VARCHAR(255). + * The contents of the subject line can be [templatized by using + * variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars). + * If this field is missing or empty, a default subject line will be + * generated. + * + * Generated from protobuf field string subject = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSubject($var) + { + GPBUtil::checkString($var, True); + $this->subject = $var; + + return $this; + } + + /** + * Optional. Links to content such as playbooks, repositories, and other + * resources. This field can contain up to 3 entries. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Documentation.Link links = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLinks() + { + return $this->links; + } + + /** + * Optional. Links to content such as playbooks, repositories, and other + * resources. This field can contain up to 3 entries. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy.Documentation.Link links = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Monitoring\V3\AlertPolicy\Documentation\Link>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation\Link::class); + $this->links = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Documentation::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation/Link.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation/Link.php new file mode 100644 index 000000000000..278b55932be5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Documentation/Link.php @@ -0,0 +1,124 @@ +google.monitoring.v3.AlertPolicy.Documentation.Link + */ +class Link extends \Google\Protobuf\Internal\Message +{ + /** + * A short display name for the link. The display name must not be empty + * or exceed 63 characters. Example: "playbook". + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * The url of a webpage. + * A url can be templatized by using variables + * in the path or the query parameters. The total length of a URL should + * not exceed 2083 characters before and after variable expansion. + * Example: "https://my_domain.com/playbook?name=${resource.name}" + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * A short display name for the link. The display name must not be empty + * or exceed 63 characters. Example: "playbook". + * @type string $url + * The url of a webpage. + * A url can be templatized by using variables + * in the path or the query parameters. The total length of a URL should + * not exceed 2083 characters before and after variable expansion. + * Example: "https://my_domain.com/playbook?name=${resource.name}" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Alert::initOnce(); + parent::__construct($data); + } + + /** + * A short display name for the link. The display name must not be empty + * or exceed 63 characters. Example: "playbook". + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A short display name for the link. The display name must not be empty + * or exceed 63 characters. Example: "playbook". + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The url of a webpage. + * A url can be templatized by using variables + * in the path or the query parameters. The total length of a URL should + * not exceed 2083 characters before and after variable expansion. + * Example: "https://my_domain.com/playbook?name=${resource.name}" + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The url of a webpage. + * A url can be templatized by using variables + * in the path or the query parameters. The total length of a URL should + * not exceed 2083 characters before and after variable expansion. + * Example: "https://my_domain.com/playbook?name=${resource.name}" + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Link::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation_Link::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Severity.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Severity.php new file mode 100644 index 000000000000..85808c4b4a58 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/AlertPolicy/Severity.php @@ -0,0 +1,75 @@ +google.monitoring.v3.AlertPolicy.Severity + */ +class Severity +{ + /** + * No severity is specified. This is the default value. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * This is the highest severity level. Use this if the problem could + * cause significant damage or downtime. + * + * Generated from protobuf enum CRITICAL = 1; + */ + const CRITICAL = 1; + /** + * This is the medium severity level. Use this if the problem could + * cause minor damage or downtime. + * + * Generated from protobuf enum ERROR = 2; + */ + const ERROR = 2; + /** + * This is the lowest severity level. Use this if the problem is not causing + * any damage or downtime, but could potentially lead to a problem in the + * future. + * + * Generated from protobuf enum WARNING = 3; + */ + const WARNING = 3; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::CRITICAL => 'CRITICAL', + self::ERROR => 'ERROR', + self::WARNING => 'WARNING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Severity::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli.php new file mode 100644 index 000000000000..5becfda99f47 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli.php @@ -0,0 +1,269 @@ +google.monitoring.v3.BasicSli + */ +class BasicSli extends \Google\Protobuf\Internal\Message +{ + /** + * OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from + * other methods will not be used to calculate performance for this SLI. If + * omitted, this SLI applies to all the Service's methods. For service types + * that don't support breaking down by method, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string method = 7; + */ + private $method; + /** + * OPTIONAL: The set of locations to which this SLI is relevant. Telemetry + * from other locations will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all locations in which the Service has + * activity. For service types that don't support breaking down by location, + * setting this field will result in an error. + * + * Generated from protobuf field repeated string location = 8; + */ + private $location; + /** + * OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry + * from other API versions will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all API versions. For service types + * that don't support breaking down by version, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string version = 9; + */ + private $version; + protected $sli_criteria; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $method + * OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from + * other methods will not be used to calculate performance for this SLI. If + * omitted, this SLI applies to all the Service's methods. For service types + * that don't support breaking down by method, setting this field will result + * in an error. + * @type array|\Google\Protobuf\Internal\RepeatedField $location + * OPTIONAL: The set of locations to which this SLI is relevant. Telemetry + * from other locations will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all locations in which the Service has + * activity. For service types that don't support breaking down by location, + * setting this field will result in an error. + * @type array|\Google\Protobuf\Internal\RepeatedField $version + * OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry + * from other API versions will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all API versions. For service types + * that don't support breaking down by version, setting this field will result + * in an error. + * @type \Google\Cloud\Monitoring\V3\BasicSli\AvailabilityCriteria $availability + * Good service is defined to be the count of requests made to this service + * that return successfully. + * @type \Google\Cloud\Monitoring\V3\BasicSli\LatencyCriteria $latency + * Good service is defined to be the count of requests made to this service + * that are fast enough with respect to `latency.threshold`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from + * other methods will not be used to calculate performance for this SLI. If + * omitted, this SLI applies to all the Service's methods. For service types + * that don't support breaking down by method, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string method = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethod() + { + return $this->method; + } + + /** + * OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from + * other methods will not be used to calculate performance for this SLI. If + * omitted, this SLI applies to all the Service's methods. For service types + * that don't support breaking down by method, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string method = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethod($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->method = $arr; + + return $this; + } + + /** + * OPTIONAL: The set of locations to which this SLI is relevant. Telemetry + * from other locations will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all locations in which the Service has + * activity. For service types that don't support breaking down by location, + * setting this field will result in an error. + * + * Generated from protobuf field repeated string location = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocation() + { + return $this->location; + } + + /** + * OPTIONAL: The set of locations to which this SLI is relevant. Telemetry + * from other locations will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all locations in which the Service has + * activity. For service types that don't support breaking down by location, + * setting this field will result in an error. + * + * Generated from protobuf field repeated string location = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->location = $arr; + + return $this; + } + + /** + * OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry + * from other API versions will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all API versions. For service types + * that don't support breaking down by version, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string version = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersion() + { + return $this->version; + } + + /** + * OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry + * from other API versions will not be used to calculate performance for this + * SLI. If omitted, this SLI applies to all API versions. For service types + * that don't support breaking down by version, setting this field will result + * in an error. + * + * Generated from protobuf field repeated string version = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersion($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->version = $arr; + + return $this; + } + + /** + * Good service is defined to be the count of requests made to this service + * that return successfully. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli.AvailabilityCriteria availability = 2; + * @return \Google\Cloud\Monitoring\V3\BasicSli\AvailabilityCriteria|null + */ + public function getAvailability() + { + return $this->readOneof(2); + } + + public function hasAvailability() + { + return $this->hasOneof(2); + } + + /** + * Good service is defined to be the count of requests made to this service + * that return successfully. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli.AvailabilityCriteria availability = 2; + * @param \Google\Cloud\Monitoring\V3\BasicSli\AvailabilityCriteria $var + * @return $this + */ + public function setAvailability($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\BasicSli\AvailabilityCriteria::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Good service is defined to be the count of requests made to this service + * that are fast enough with respect to `latency.threshold`. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli.LatencyCriteria latency = 3; + * @return \Google\Cloud\Monitoring\V3\BasicSli\LatencyCriteria|null + */ + public function getLatency() + { + return $this->readOneof(3); + } + + public function hasLatency() + { + return $this->hasOneof(3); + } + + /** + * Good service is defined to be the count of requests made to this service + * that are fast enough with respect to `latency.threshold`. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli.LatencyCriteria latency = 3; + * @param \Google\Cloud\Monitoring\V3\BasicSli\LatencyCriteria $var + * @return $this + */ + public function setLatency($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\BasicSli\LatencyCriteria::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getSliCriteria() + { + return $this->whichOneof("sli_criteria"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/AvailabilityCriteria.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/AvailabilityCriteria.php new file mode 100644 index 000000000000..39790b19ee01 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/AvailabilityCriteria.php @@ -0,0 +1,36 @@ +google.monitoring.v3.BasicSli.AvailabilityCriteria + */ +class AvailabilityCriteria extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AvailabilityCriteria::class, \Google\Cloud\Monitoring\V3\BasicSli_AvailabilityCriteria::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/LatencyCriteria.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/LatencyCriteria.php new file mode 100644 index 000000000000..331b6b6e46f4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/BasicSli/LatencyCriteria.php @@ -0,0 +1,84 @@ +google.monitoring.v3.BasicSli.LatencyCriteria + */ +class LatencyCriteria extends \Google\Protobuf\Internal\Message +{ + /** + * Good service is defined to be the count of requests made to this service + * that return in no more than `threshold`. + * + * Generated from protobuf field .google.protobuf.Duration threshold = 3; + */ + protected $threshold = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $threshold + * Good service is defined to be the count of requests made to this service + * that return in no more than `threshold`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Good service is defined to be the count of requests made to this service + * that return in no more than `threshold`. + * + * Generated from protobuf field .google.protobuf.Duration threshold = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getThreshold() + { + return $this->threshold; + } + + public function hasThreshold() + { + return isset($this->threshold); + } + + public function clearThreshold() + { + unset($this->threshold); + } + + /** + * Good service is defined to be the count of requests made to this service + * that return in no more than `threshold`. + * + * Generated from protobuf field .google.protobuf.Duration threshold = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setThreshold($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->threshold = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LatencyCriteria::class, \Google\Cloud\Monitoring\V3\BasicSli_LatencyCriteria::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ComparisonType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ComparisonType.php new file mode 100644 index 000000000000..d86a3fbc2cde --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ComparisonType.php @@ -0,0 +1,90 @@ +google.monitoring.v3.ComparisonType + */ +class ComparisonType +{ + /** + * No ordering relationship is specified. + * + * Generated from protobuf enum COMPARISON_UNSPECIFIED = 0; + */ + const COMPARISON_UNSPECIFIED = 0; + /** + * True if the left argument is greater than the right argument. + * + * Generated from protobuf enum COMPARISON_GT = 1; + */ + const COMPARISON_GT = 1; + /** + * True if the left argument is greater than or equal to the right argument. + * + * Generated from protobuf enum COMPARISON_GE = 2; + */ + const COMPARISON_GE = 2; + /** + * True if the left argument is less than the right argument. + * + * Generated from protobuf enum COMPARISON_LT = 3; + */ + const COMPARISON_LT = 3; + /** + * True if the left argument is less than or equal to the right argument. + * + * Generated from protobuf enum COMPARISON_LE = 4; + */ + const COMPARISON_LE = 4; + /** + * True if the left argument is equal to the right argument. + * + * Generated from protobuf enum COMPARISON_EQ = 5; + */ + const COMPARISON_EQ = 5; + /** + * True if the left argument is not equal to the right argument. + * + * Generated from protobuf enum COMPARISON_NE = 6; + */ + const COMPARISON_NE = 6; + + private static $valueToName = [ + self::COMPARISON_UNSPECIFIED => 'COMPARISON_UNSPECIFIED', + self::COMPARISON_GT => 'COMPARISON_GT', + self::COMPARISON_GE => 'COMPARISON_GE', + self::COMPARISON_LT => 'COMPARISON_LT', + self::COMPARISON_LE => 'COMPARISON_LE', + self::COMPARISON_EQ => 'COMPARISON_EQ', + self::COMPARISON_NE => 'COMPARISON_NE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateAlertPolicyRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateAlertPolicyRequest.php new file mode 100644 index 000000000000..6c9c18ef40f4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateAlertPolicyRequest.php @@ -0,0 +1,188 @@ +google.monitoring.v3.CreateAlertPolicyRequest + */ +class CreateAlertPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $alert_policy = null; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * @param \Google\Cloud\Monitoring\V3\AlertPolicy $alertPolicy Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * + * @return \Google\Cloud\Monitoring\V3\CreateAlertPolicyRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\Monitoring\V3\AlertPolicy $alertPolicy): self + { + return (new self()) + ->setName($name) + ->setAlertPolicy($alertPolicy); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy $alert_policy + * Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy|null + */ + public function getAlertPolicy() + { + return $this->alert_policy; + } + + public function hasAlertPolicy() + { + return isset($this->alert_policy); + } + + public function clearAlertPolicy() + { + unset($this->alert_policy); + } + + /** + * Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy $var + * @return $this + */ + public function setAlertPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy::class); + $this->alert_policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateGroupRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateGroupRequest.php new file mode 100644 index 000000000000..bad7c64edac4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateGroupRequest.php @@ -0,0 +1,181 @@ +google.monitoring.v3.CreateGroupRequest + */ +class CreateGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group = null; + /** + * If true, validate this request but do not create the group. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param \Google\Cloud\Monitoring\V3\Group $group Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * + * @return \Google\Cloud\Monitoring\V3\CreateGroupRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\Monitoring\V3\Group $group): self + { + return (new self()) + ->setName($name) + ->setGroup($group); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type \Google\Cloud\Monitoring\V3\Group $group + * Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * @type bool $validate_only + * If true, validate this request but do not create the group. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Group|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Group $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Group::class); + $this->group = $var; + + return $this; + } + + /** + * If true, validate this request but do not create the group. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If true, validate this request but do not create the group. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateMetricDescriptorRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateMetricDescriptorRequest.php new file mode 100644 index 000000000000..45d737e63e85 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateMetricDescriptorRequest.php @@ -0,0 +1,151 @@ +google.monitoring.v3.CreateMetricDescriptorRequest + */ +class CreateMetricDescriptorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * + * Generated from protobuf field .google.api.MetricDescriptor metric_descriptor = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $metric_descriptor = null; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * @param \Google\Api\MetricDescriptor $metricDescriptor Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * + * @return \Google\Cloud\Monitoring\V3\CreateMetricDescriptorRequest + * + * @experimental + */ + public static function build(string $name, \Google\Api\MetricDescriptor $metricDescriptor): self + { + return (new self()) + ->setName($name) + ->setMetricDescriptor($metricDescriptor); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * @type \Google\Api\MetricDescriptor $metric_descriptor + * Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * + * Generated from protobuf field .google.api.MetricDescriptor metric_descriptor = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Api\MetricDescriptor|null + */ + public function getMetricDescriptor() + { + return $this->metric_descriptor; + } + + public function hasMetricDescriptor() + { + return isset($this->metric_descriptor); + } + + public function clearMetricDescriptor() + { + unset($this->metric_descriptor); + } + + /** + * Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * + * Generated from protobuf field .google.api.MetricDescriptor metric_descriptor = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Api\MetricDescriptor $var + * @return $this + */ + public function setMetricDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Api\MetricDescriptor::class); + $this->metric_descriptor = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateNotificationChannelRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateNotificationChannelRequest.php new file mode 100644 index 000000000000..2a528898bebc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateNotificationChannelRequest.php @@ -0,0 +1,163 @@ +google.monitoring.v3.CreateNotificationChannelRequest + */ +class CreateNotificationChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The definition of the `NotificationChannel` to create. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $notification_channel = null; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * @param \Google\Cloud\Monitoring\V3\NotificationChannel $notificationChannel Required. The definition of the `NotificationChannel` to create. + * + * @return \Google\Cloud\Monitoring\V3\CreateNotificationChannelRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\Monitoring\V3\NotificationChannel $notificationChannel): self + { + return (new self()) + ->setName($name) + ->setNotificationChannel($notificationChannel); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * @type \Google\Cloud\Monitoring\V3\NotificationChannel $notification_channel + * Required. The definition of the `NotificationChannel` to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The definition of the `NotificationChannel` to create. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\NotificationChannel|null + */ + public function getNotificationChannel() + { + return $this->notification_channel; + } + + public function hasNotificationChannel() + { + return isset($this->notification_channel); + } + + public function clearNotificationChannel() + { + unset($this->notification_channel); + } + + /** + * Required. The definition of the `NotificationChannel` to create. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\NotificationChannel $var + * @return $this + */ + public function setNotificationChannel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\NotificationChannel::class); + $this->notification_channel = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceLevelObjectiveRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceLevelObjectiveRequest.php new file mode 100644 index 000000000000..151f66b7a84c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceLevelObjectiveRequest.php @@ -0,0 +1,185 @@ +google.monitoring.v3.CreateServiceLevelObjectiveRequest + */ +class CreateServiceLevelObjectiveRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the parent `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * + * Generated from protobuf field string service_level_objective_id = 3; + */ + protected $service_level_objective_id = ''; + /** + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_level_objective = null; + + /** + * @param string $parent Required. Resource name of the parent `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * Please see {@see ServiceMonitoringServiceClient::serviceName()} for help formatting this field. + * @param \Google\Cloud\Monitoring\V3\ServiceLevelObjective $serviceLevelObjective Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * + * @return \Google\Cloud\Monitoring\V3\CreateServiceLevelObjectiveRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Monitoring\V3\ServiceLevelObjective $serviceLevelObjective): self + { + return (new self()) + ->setParent($parent) + ->setServiceLevelObjective($serviceLevelObjective); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the parent `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @type string $service_level_objective_id + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * @type \Google\Cloud\Monitoring\V3\ServiceLevelObjective $service_level_objective + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the parent `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the parent `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * + * Generated from protobuf field string service_level_objective_id = 3; + * @return string + */ + public function getServiceLevelObjectiveId() + { + return $this->service_level_objective_id; + } + + /** + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * + * Generated from protobuf field string service_level_objective_id = 3; + * @param string $var + * @return $this + */ + public function setServiceLevelObjectiveId($var) + { + GPBUtil::checkString($var, True); + $this->service_level_objective_id = $var; + + return $this; + } + + /** + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\ServiceLevelObjective|null + */ + public function getServiceLevelObjective() + { + return $this->service_level_objective; + } + + public function hasServiceLevelObjective() + { + return isset($this->service_level_objective); + } + + public function clearServiceLevelObjective() + { + unset($this->service_level_objective); + } + + /** + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\ServiceLevelObjective $var + * @return $this + */ + public function setServiceLevelObjective($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\ServiceLevelObjective::class); + $this->service_level_objective = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceRequest.php new file mode 100644 index 000000000000..7d9425e30c52 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateServiceRequest.php @@ -0,0 +1,180 @@ +google.monitoring.v3.CreateServiceRequest + */ +class CreateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * + * Generated from protobuf field string service_id = 3; + */ + protected $service_id = ''; + /** + * Required. The `Service` to create. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + + /** + * @param string $parent Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param \Google\Cloud\Monitoring\V3\Service $service Required. The `Service` to create. + * + * @return \Google\Cloud\Monitoring\V3\CreateServiceRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Monitoring\V3\Service $service): self + { + return (new self()) + ->setParent($parent) + ->setService($service); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $service_id + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * @type \Google\Cloud\Monitoring\V3\Service $service + * Required. The `Service` to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * + * Generated from protobuf field string service_id = 3; + * @return string + */ + public function getServiceId() + { + return $this->service_id; + } + + /** + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * + * Generated from protobuf field string service_id = 3; + * @param string $var + * @return $this + */ + public function setServiceId($var) + { + GPBUtil::checkString($var, True); + $this->service_id = $var; + + return $this; + } + + /** + * Required. The `Service` to create. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The `Service` to create. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service::class); + $this->service = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateSnoozeRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateSnoozeRequest.php new file mode 100644 index 000000000000..c03b63fbc9d1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateSnoozeRequest.php @@ -0,0 +1,149 @@ +google.monitoring.v3.CreateSnoozeRequest + */ +class CreateSnoozeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $snooze = null; + + /** + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * Please see {@see SnoozeServiceClient::workspaceName()} for help formatting this field. + * @param \Google\Cloud\Monitoring\V3\Snooze $snooze Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * + * @return \Google\Cloud\Monitoring\V3\CreateSnoozeRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Monitoring\V3\Snooze $snooze): self + { + return (new self()) + ->setParent($parent) + ->setSnooze($snooze); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type \Google\Cloud\Monitoring\V3\Snooze $snooze + * Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SnoozeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Snooze|null + */ + public function getSnooze() + { + return $this->snooze; + } + + public function hasSnooze() + { + return isset($this->snooze); + } + + public function clearSnooze() + { + unset($this->snooze); + } + + /** + * Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Snooze $var + * @return $this + */ + public function setSnooze($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Snooze::class); + $this->snooze = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesError.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesError.php new file mode 100644 index 000000000000..556d57d66086 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesError.php @@ -0,0 +1,135 @@ +google.monitoring.v3.CreateTimeSeriesError + */ +class CreateTimeSeriesError extends \Google\Protobuf\Internal\Message +{ + /** + * DEPRECATED. Time series ID that resulted in the `status` error. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeries time_series = 1 [deprecated = true]; + * @deprecated + */ + protected $time_series = null; + /** + * DEPRECATED. The status of the requested write operation for `time_series`. + * + * Generated from protobuf field .google.rpc.Status status = 2 [deprecated = true]; + * @deprecated + */ + protected $status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\TimeSeries $time_series + * DEPRECATED. Time series ID that resulted in the `status` error. + * @type \Google\Rpc\Status $status + * DEPRECATED. The status of the requested write operation for `time_series`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * DEPRECATED. Time series ID that resulted in the `status` error. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeries time_series = 1 [deprecated = true]; + * @return \Google\Cloud\Monitoring\V3\TimeSeries|null + * @deprecated + */ + public function getTimeSeries() + { + @trigger_error('time_series is deprecated.', E_USER_DEPRECATED); + return $this->time_series; + } + + public function hasTimeSeries() + { + @trigger_error('time_series is deprecated.', E_USER_DEPRECATED); + return isset($this->time_series); + } + + public function clearTimeSeries() + { + @trigger_error('time_series is deprecated.', E_USER_DEPRECATED); + unset($this->time_series); + } + + /** + * DEPRECATED. Time series ID that resulted in the `status` error. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeries time_series = 1 [deprecated = true]; + * @param \Google\Cloud\Monitoring\V3\TimeSeries $var + * @return $this + * @deprecated + */ + public function setTimeSeries($var) + { + @trigger_error('time_series is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeSeries::class); + $this->time_series = $var; + + return $this; + } + + /** + * DEPRECATED. The status of the requested write operation for `time_series`. + * + * Generated from protobuf field .google.rpc.Status status = 2 [deprecated = true]; + * @return \Google\Rpc\Status|null + * @deprecated + */ + public function getStatus() + { + @trigger_error('status is deprecated.', E_USER_DEPRECATED); + return $this->status; + } + + public function hasStatus() + { + @trigger_error('status is deprecated.', E_USER_DEPRECATED); + return isset($this->status); + } + + public function clearStatus() + { + @trigger_error('status is deprecated.', E_USER_DEPRECATED); + unset($this->status); + } + + /** + * DEPRECATED. The status of the requested write operation for `time_series`. + * + * Generated from protobuf field .google.rpc.Status status = 2 [deprecated = true]; + * @param \Google\Rpc\Status $var + * @return $this + * @deprecated + */ + public function setStatus($var) + { + @trigger_error('status is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesRequest.php new file mode 100644 index 000000000000..66cb39cd93ac --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesRequest.php @@ -0,0 +1,159 @@ +google.monitoring.v3.CreateTimeSeriesRequest + */ +class CreateTimeSeriesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $time_series; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * Please see {@see MetricServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\Monitoring\V3\TimeSeries[] $timeSeries Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * + * @return \Google\Cloud\Monitoring\V3\CreateTimeSeriesRequest + * + * @experimental + */ + public static function build(string $name, array $timeSeries): self + { + return (new self()) + ->setName($name) + ->setTimeSeries($timeSeries); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type array<\Google\Cloud\Monitoring\V3\TimeSeries>|\Google\Protobuf\Internal\RepeatedField $time_series + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeSeries() + { + return $this->time_series; + } + + /** + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Monitoring\V3\TimeSeries>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeSeries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeries::class); + $this->time_series = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary.php new file mode 100644 index 000000000000..8fb4fe1f025c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary.php @@ -0,0 +1,135 @@ +google.monitoring.v3.CreateTimeSeriesSummary + */ +class CreateTimeSeriesSummary extends \Google\Protobuf\Internal\Message +{ + /** + * The number of points in the request. + * + * Generated from protobuf field int32 total_point_count = 1; + */ + protected $total_point_count = 0; + /** + * The number of points that were successfully written. + * + * Generated from protobuf field int32 success_point_count = 2; + */ + protected $success_point_count = 0; + /** + * The number of points that failed to be written. Order is not guaranteed. + * + * Generated from protobuf field repeated .google.monitoring.v3.CreateTimeSeriesSummary.Error errors = 3; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $total_point_count + * The number of points in the request. + * @type int $success_point_count + * The number of points that were successfully written. + * @type array<\Google\Cloud\Monitoring\V3\CreateTimeSeriesSummary\Error>|\Google\Protobuf\Internal\RepeatedField $errors + * The number of points that failed to be written. Order is not guaranteed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * The number of points in the request. + * + * Generated from protobuf field int32 total_point_count = 1; + * @return int + */ + public function getTotalPointCount() + { + return $this->total_point_count; + } + + /** + * The number of points in the request. + * + * Generated from protobuf field int32 total_point_count = 1; + * @param int $var + * @return $this + */ + public function setTotalPointCount($var) + { + GPBUtil::checkInt32($var); + $this->total_point_count = $var; + + return $this; + } + + /** + * The number of points that were successfully written. + * + * Generated from protobuf field int32 success_point_count = 2; + * @return int + */ + public function getSuccessPointCount() + { + return $this->success_point_count; + } + + /** + * The number of points that were successfully written. + * + * Generated from protobuf field int32 success_point_count = 2; + * @param int $var + * @return $this + */ + public function setSuccessPointCount($var) + { + GPBUtil::checkInt32($var); + $this->success_point_count = $var; + + return $this; + } + + /** + * The number of points that failed to be written. Order is not guaranteed. + * + * Generated from protobuf field repeated .google.monitoring.v3.CreateTimeSeriesSummary.Error errors = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * The number of points that failed to be written. Order is not guaranteed. + * + * Generated from protobuf field repeated .google.monitoring.v3.CreateTimeSeriesSummary.Error errors = 3; + * @param array<\Google\Cloud\Monitoring\V3\CreateTimeSeriesSummary\Error>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\CreateTimeSeriesSummary\Error::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary/Error.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary/Error.php new file mode 100644 index 000000000000..5bd917825b90 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateTimeSeriesSummary/Error.php @@ -0,0 +1,114 @@ +google.monitoring.v3.CreateTimeSeriesSummary.Error + */ +class Error extends \Google\Protobuf\Internal\Message +{ + /** + * The status of the requested write operation. + * + * Generated from protobuf field .google.rpc.Status status = 1; + */ + protected $status = null; + /** + * The number of points that couldn't be written because of `status`. + * + * Generated from protobuf field int32 point_count = 2; + */ + protected $point_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Rpc\Status $status + * The status of the requested write operation. + * @type int $point_count + * The number of points that couldn't be written because of `status`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * The status of the requested write operation. + * + * Generated from protobuf field .google.rpc.Status status = 1; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * The status of the requested write operation. + * + * Generated from protobuf field .google.rpc.Status status = 1; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + + /** + * The number of points that couldn't be written because of `status`. + * + * Generated from protobuf field int32 point_count = 2; + * @return int + */ + public function getPointCount() + { + return $this->point_count; + } + + /** + * The number of points that couldn't be written because of `status`. + * + * Generated from protobuf field int32 point_count = 2; + * @param int $var + * @return $this + */ + public function setPointCount($var) + { + GPBUtil::checkInt32($var); + $this->point_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Error::class, \Google\Cloud\Monitoring\V3\CreateTimeSeriesSummary_Error::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateUptimeCheckConfigRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateUptimeCheckConfigRequest.php new file mode 100644 index 000000000000..991e2028b3ae --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/CreateUptimeCheckConfigRequest.php @@ -0,0 +1,142 @@ +google.monitoring.v3.CreateUptimeCheckConfigRequest + */ +class CreateUptimeCheckConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The new Uptime check configuration. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uptime_check_config = null; + + /** + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptimeCheckConfig Required. The new Uptime check configuration. + * + * @return \Google\Cloud\Monitoring\V3\CreateUptimeCheckConfigRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptimeCheckConfig): self + { + return (new self()) + ->setParent($parent) + ->setUptimeCheckConfig($uptimeCheckConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptime_check_config + * Required. The new Uptime check configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The new Uptime check configuration. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig|null + */ + public function getUptimeCheckConfig() + { + return $this->uptime_check_config; + } + + public function hasUptimeCheckConfig() + { + return isset($this->uptime_check_config); + } + + public function clearUptimeCheckConfig() + { + unset($this->uptime_check_config); + } + + /** + * Required. The new Uptime check configuration. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig $var + * @return $this + */ + public function setUptimeCheckConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig::class); + $this->uptime_check_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteAlertPolicyRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteAlertPolicyRequest.php new file mode 100644 index 000000000000..2333c3a46912 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteAlertPolicyRequest.php @@ -0,0 +1,93 @@ +google.monitoring.v3.DeleteAlertPolicyRequest + */ +class DeleteAlertPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The alerting policy to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The alerting policy to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. Please see + * {@see AlertPolicyServiceClient::alertPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteAlertPolicyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The alerting policy to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The alerting policy to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The alerting policy to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteGroupRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteGroupRequest.php new file mode 100644 index 000000000000..b63a0bdb79fe --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteGroupRequest.php @@ -0,0 +1,130 @@ +google.monitoring.v3.DeleteGroupRequest + */ +class DeleteGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * + * Generated from protobuf field bool recursive = 4; + */ + protected $recursive = false; + + /** + * @param string $name Required. The group to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Please see {@see GroupServiceClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteGroupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The group to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @type bool $recursive + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The group to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * + * Generated from protobuf field bool recursive = 4; + * @return bool + */ + public function getRecursive() + { + return $this->recursive; + } + + /** + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * + * Generated from protobuf field bool recursive = 4; + * @param bool $var + * @return $this + */ + public function setRecursive($var) + { + GPBUtil::checkBool($var); + $this->recursive = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteMetricDescriptorRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteMetricDescriptorRequest.php new file mode 100644 index 000000000000..3d57dd66af31 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteMetricDescriptorRequest.php @@ -0,0 +1,103 @@ +google.monitoring.v3.DeleteMetricDescriptorRequest + */ +class DeleteMetricDescriptorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. Please see + * {@see MetricServiceClient::metricDescriptorName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteMetricDescriptorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteNotificationChannelRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteNotificationChannelRequest.php new file mode 100644 index 000000000000..d547bd360b46 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteNotificationChannelRequest.php @@ -0,0 +1,138 @@ +google.monitoring.v3.DeleteNotificationChannelRequest + */ +class DeleteNotificationChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * + * Generated from protobuf field bool force = 5; + */ + protected $force = false; + + /** + * @param string $name Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * Please see {@see NotificationChannelServiceClient::notificationChannelName()} for help formatting this field. + * @param bool $force If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * + * @return \Google\Cloud\Monitoring\V3\DeleteNotificationChannelRequest + * + * @experimental + */ + public static function build(string $name, bool $force): self + { + return (new self()) + ->setName($name) + ->setForce($force); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @type bool $force + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * + * Generated from protobuf field bool force = 5; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * + * Generated from protobuf field bool force = 5; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceLevelObjectiveRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceLevelObjectiveRequest.php new file mode 100644 index 000000000000..8771b8fb4ab7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceLevelObjectiveRequest.php @@ -0,0 +1,92 @@ +google.monitoring.v3.DeleteServiceLevelObjectiveRequest + */ +class DeleteServiceLevelObjectiveRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * Please see {@see ServiceMonitoringServiceClient::serviceLevelObjectiveName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteServiceLevelObjectiveRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceRequest.php new file mode 100644 index 000000000000..378fecd0724b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteServiceRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.DeleteServiceRequest + */ +class DeleteServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the `Service` to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the `Service` to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * Please see {@see ServiceMonitoringServiceClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteServiceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the `Service` to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the `Service` to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the `Service` to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteUptimeCheckConfigRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteUptimeCheckConfigRequest.php new file mode 100644 index 000000000000..dfda97aa0167 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DeleteUptimeCheckConfigRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.DeleteUptimeCheckConfigRequest + */ +class DeleteUptimeCheckConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Uptime check configuration to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The Uptime check configuration to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * Please see {@see UptimeCheckServiceClient::uptimeCheckConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\DeleteUptimeCheckConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Uptime check configuration to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Uptime check configuration to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Uptime check configuration to delete. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DistributionCut.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DistributionCut.php new file mode 100644 index 000000000000..cffd93e1651b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DistributionCut.php @@ -0,0 +1,127 @@ +google.monitoring.v3.DistributionCut + */ +class DistributionCut extends \Google\Protobuf\Internal\Message +{ + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` aggregating values. Must have `ValueType = + * DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string distribution_filter = 4; + */ + protected $distribution_filter = ''; + /** + * Range of values considered "good." For a one-sided range, set one bound to + * an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 5; + */ + protected $range = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $distribution_filter + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` aggregating values. Must have `ValueType = + * DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * @type \Google\Cloud\Monitoring\V3\Range $range + * Range of values considered "good." For a one-sided range, set one bound to + * an infinite value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` aggregating values. Must have `ValueType = + * DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string distribution_filter = 4; + * @return string + */ + public function getDistributionFilter() + { + return $this->distribution_filter; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` aggregating values. Must have `ValueType = + * DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string distribution_filter = 4; + * @param string $var + * @return $this + */ + public function setDistributionFilter($var) + { + GPBUtil::checkString($var, True); + $this->distribution_filter = $var; + + return $this; + } + + /** + * Range of values considered "good." For a one-sided range, set one bound to + * an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 5; + * @return \Google\Cloud\Monitoring\V3\Range|null + */ + public function getRange() + { + return $this->range; + } + + public function hasRange() + { + return isset($this->range); + } + + public function clearRange() + { + unset($this->range); + } + + /** + * Range of values considered "good." For a one-sided range, set one bound to + * an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 5; + * @param \Google\Cloud\Monitoring\V3\Range $var + * @return $this + */ + public function setRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Range::class); + $this->range = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DroppedLabels.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DroppedLabels.php new file mode 100644 index 000000000000..4fb73d3bdd71 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/DroppedLabels.php @@ -0,0 +1,80 @@ +google.monitoring.v3.DroppedLabels + */ +class DroppedLabels extends \Google\Protobuf\Internal\Message +{ + /** + * Map from label to its value, for all labels dropped in any aggregation. + * + * Generated from protobuf field map label = 1; + */ + private $label; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $label + * Map from label to its value, for all labels dropped in any aggregation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\DroppedLabels::initOnce(); + parent::__construct($data); + } + + /** + * Map from label to its value, for all labels dropped in any aggregation. + * + * Generated from protobuf field map label = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabel() + { + return $this->label; + } + + /** + * Map from label to its value, for all labels dropped in any aggregation. + * + * Generated from protobuf field map label = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabel($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->label = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetAlertPolicyRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetAlertPolicyRequest.php new file mode 100644 index 000000000000..573ae71a8ad5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetAlertPolicyRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetAlertPolicyRequest + */ +class GetAlertPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The alerting policy to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The alerting policy to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * Please see {@see AlertPolicyServiceClient::alertPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetAlertPolicyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The alerting policy to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The alerting policy to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The alerting policy to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetGroupRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetGroupRequest.php new file mode 100644 index 000000000000..da9c56f0a13a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetGroupRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetGroupRequest + */ +class GetGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The group to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Please see {@see GroupServiceClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetGroupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The group to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The group to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMetricDescriptorRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMetricDescriptorRequest.php new file mode 100644 index 000000000000..360bdfac4cc5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMetricDescriptorRequest.php @@ -0,0 +1,103 @@ +google.monitoring.v3.GetMetricDescriptorRequest + */ +class GetMetricDescriptorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. Please see + * {@see MetricServiceClient::metricDescriptorName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetMetricDescriptorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The metric descriptor on which to execute the request. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMonitoredResourceDescriptorRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMonitoredResourceDescriptorRequest.php new file mode 100644 index 000000000000..82d4800c5e15 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetMonitoredResourceDescriptorRequest.php @@ -0,0 +1,98 @@ +google.monitoring.v3.GetMonitoredResourceDescriptorRequest + */ +class GetMonitoredResourceDescriptorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The monitored resource descriptor to get. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The monitored resource descriptor to get. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. Please see + * {@see MetricServiceClient::monitoredResourceDescriptorName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetMonitoredResourceDescriptorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The monitored resource descriptor to get. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The monitored resource descriptor to get. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The monitored resource descriptor to get. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelDescriptorRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelDescriptorRequest.php new file mode 100644 index 000000000000..f7ff869b7298 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelDescriptorRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetNotificationChannelDescriptorRequest + */ +class GetNotificationChannelDescriptorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The channel type for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The channel type for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * Please see {@see NotificationChannelServiceClient::notificationChannelDescriptorName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetNotificationChannelDescriptorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The channel type for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The channel type for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The channel type for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelRequest.php new file mode 100644 index 000000000000..708a1446cd9c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetNotificationChannelRequest + */ +class GetNotificationChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * Please see {@see NotificationChannelServiceClient::notificationChannelName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetNotificationChannelRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The channel for which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeRequest.php new file mode 100644 index 000000000000..acb10877c211 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeRequest.php @@ -0,0 +1,167 @@ +google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + */ +class GetNotificationChannelVerificationCodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + */ + protected $expire_time = null; + + /** + * @param string $name Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. Please see + * {@see NotificationChannelServiceClient::notificationChannelName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetNotificationChannelVerificationCodeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * @type \Google\Protobuf\Timestamp $expire_time + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeResponse.php new file mode 100644 index 000000000000..b62d064177a3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetNotificationChannelVerificationCodeResponse.php @@ -0,0 +1,131 @@ +google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + */ +class GetNotificationChannelVerificationCodeResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The verification code, which may be used to verify other channels + * that have an equivalent identity (i.e. other channels of the same + * type with the same fingerprint such as other email channels with + * the same email address or other sms channels with the same number). + * + * Generated from protobuf field string code = 1; + */ + protected $code = ''; + /** + * The expiration time associated with the code that was returned. If + * an expiration was provided in the request, this is the minimum of the + * requested expiration in the request and the max permitted expiration. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + */ + protected $expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $code + * The verification code, which may be used to verify other channels + * that have an equivalent identity (i.e. other channels of the same + * type with the same fingerprint such as other email channels with + * the same email address or other sms channels with the same number). + * @type \Google\Protobuf\Timestamp $expire_time + * The expiration time associated with the code that was returned. If + * an expiration was provided in the request, this is the minimum of the + * requested expiration in the request and the max permitted expiration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * The verification code, which may be used to verify other channels + * that have an equivalent identity (i.e. other channels of the same + * type with the same fingerprint such as other email channels with + * the same email address or other sms channels with the same number). + * + * Generated from protobuf field string code = 1; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * The verification code, which may be used to verify other channels + * that have an equivalent identity (i.e. other channels of the same + * type with the same fingerprint such as other email channels with + * the same email address or other sms channels with the same number). + * + * Generated from protobuf field string code = 1; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + + /** + * The expiration time associated with the code that was returned. If + * an expiration was provided in the request, this is the minimum of the + * requested expiration in the request and the max permitted expiration. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The expiration time associated with the code that was returned. If + * an expiration was provided in the request, this is the minimum of the + * requested expiration in the request and the max permitted expiration. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceLevelObjectiveRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceLevelObjectiveRequest.php new file mode 100644 index 000000000000..c22d24403f63 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceLevelObjectiveRequest.php @@ -0,0 +1,138 @@ +google.monitoring.v3.GetServiceLevelObjectiveRequest + */ +class GetServiceLevelObjectiveRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 2; + */ + protected $view = 0; + + /** + * @param string $name Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * Please see {@see ServiceMonitoringServiceClient::serviceLevelObjectiveName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetServiceLevelObjectiveRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @type int $view + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\ServiceLevelObjective\View::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceRequest.php new file mode 100644 index 000000000000..6113d513f423 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetServiceRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetServiceRequest + */ +class GetServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * Please see {@see ServiceMonitoringServiceClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetServiceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the `Service`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetSnoozeRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetSnoozeRequest.php new file mode 100644 index 000000000000..83b9da5e20f6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetSnoozeRequest.php @@ -0,0 +1,88 @@ +google.monitoring.v3.GetSnoozeRequest + */ +class GetSnoozeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID of the `Snooze` to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The ID of the `Snooze` to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * Please see {@see SnoozeServiceClient::snoozeName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetSnoozeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ID of the `Snooze` to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SnoozeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID of the `Snooze` to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ID of the `Snooze` to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetUptimeCheckConfigRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetUptimeCheckConfigRequest.php new file mode 100644 index 000000000000..83b9a3f2eaa3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GetUptimeCheckConfigRequest.php @@ -0,0 +1,87 @@ +google.monitoring.v3.GetUptimeCheckConfigRequest + */ +class GetUptimeCheckConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Uptime check configuration to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The Uptime check configuration to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * Please see {@see UptimeCheckServiceClient::uptimeCheckConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\GetUptimeCheckConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Uptime check configuration to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Uptime check configuration to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Uptime check configuration to retrieve. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Group.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Group.php new file mode 100644 index 000000000000..4a768d02d746 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Group.php @@ -0,0 +1,257 @@ +google.monitoring.v3.Group + */ +class Group extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of this group. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * When creating a group, this field is ignored and a new name is created + * consisting of the project specified in the call to `CreateGroup` + * and a unique `[GROUP_ID]` that is generated automatically. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A user-assigned name for this group, used only for display purposes. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The name of the group's parent, if it has one. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * For groups with no parent, `parent_name` is the empty string, `""`. + * + * Generated from protobuf field string parent_name = 3; + */ + protected $parent_name = ''; + /** + * The filter used to determine which monitored resources belong to this + * group. + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * If true, the members of this group are considered to be a cluster. + * The system can perform additional analysis on groups that are clusters. + * + * Generated from protobuf field bool is_cluster = 6; + */ + protected $is_cluster = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of this group. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * When creating a group, this field is ignored and a new name is created + * consisting of the project specified in the call to `CreateGroup` + * and a unique `[GROUP_ID]` that is generated automatically. + * @type string $display_name + * A user-assigned name for this group, used only for display purposes. + * @type string $parent_name + * The name of the group's parent, if it has one. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * For groups with no parent, `parent_name` is the empty string, `""`. + * @type string $filter + * The filter used to determine which monitored resources belong to this + * group. + * @type bool $is_cluster + * If true, the members of this group are considered to be a cluster. + * The system can perform additional analysis on groups that are clusters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Group::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of this group. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * When creating a group, this field is ignored and a new name is created + * consisting of the project specified in the call to `CreateGroup` + * and a unique `[GROUP_ID]` that is generated automatically. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of this group. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * When creating a group, this field is ignored and a new name is created + * consisting of the project specified in the call to `CreateGroup` + * and a unique `[GROUP_ID]` that is generated automatically. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A user-assigned name for this group, used only for display purposes. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A user-assigned name for this group, used only for display purposes. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The name of the group's parent, if it has one. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * For groups with no parent, `parent_name` is the empty string, `""`. + * + * Generated from protobuf field string parent_name = 3; + * @return string + */ + public function getParentName() + { + return $this->parent_name; + } + + /** + * The name of the group's parent, if it has one. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * For groups with no parent, `parent_name` is the empty string, `""`. + * + * Generated from protobuf field string parent_name = 3; + * @param string $var + * @return $this + */ + public function setParentName($var) + { + GPBUtil::checkString($var, True); + $this->parent_name = $var; + + return $this; + } + + /** + * The filter used to determine which monitored resources belong to this + * group. + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter used to determine which monitored resources belong to this + * group. + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * If true, the members of this group are considered to be a cluster. + * The system can perform additional analysis on groups that are clusters. + * + * Generated from protobuf field bool is_cluster = 6; + * @return bool + */ + public function getIsCluster() + { + return $this->is_cluster; + } + + /** + * If true, the members of this group are considered to be a cluster. + * The system can perform additional analysis on groups that are clusters. + * + * Generated from protobuf field bool is_cluster = 6; + * @param bool $var + * @return $this + */ + public function setIsCluster($var) + { + GPBUtil::checkBool($var); + $this->is_cluster = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GroupResourceType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GroupResourceType.php new file mode 100644 index 000000000000..ddf9d0eee1a8 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/GroupResourceType.php @@ -0,0 +1,66 @@ +google.monitoring.v3.GroupResourceType + */ +class GroupResourceType +{ + /** + * Default value (not valid). + * + * Generated from protobuf enum RESOURCE_TYPE_UNSPECIFIED = 0; + */ + const RESOURCE_TYPE_UNSPECIFIED = 0; + /** + * A group of instances from Google Cloud Platform (GCP) or + * Amazon Web Services (AWS). + * + * Generated from protobuf enum INSTANCE = 1; + */ + const INSTANCE = 1; + /** + * A group of Amazon ELB load balancers. + * + * Generated from protobuf enum AWS_ELB_LOAD_BALANCER = 2; + */ + const AWS_ELB_LOAD_BALANCER = 2; + + private static $valueToName = [ + self::RESOURCE_TYPE_UNSPECIFIED => 'RESOURCE_TYPE_UNSPECIFIED', + self::INSTANCE => 'INSTANCE', + self::AWS_ELB_LOAD_BALANCER => 'AWS_ELB_LOAD_BALANCER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker.php new file mode 100644 index 000000000000..19273fdc3f2b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker.php @@ -0,0 +1,271 @@ +google.monitoring.v3.InternalChecker + */ +class InternalChecker extends \Google\Protobuf\Internal\Message +{ + /** + * A unique resource name for this InternalChecker. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for + * the Uptime check config associated with the internal checker. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The checker's human-readable name. The display name + * should be unique within a Cloud Monitoring Metrics Scope in order to make + * it easier to identify; however, uniqueness is not enforced. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the + * internal resource lives (ex: "default"). + * + * Generated from protobuf field string network = 3; + */ + protected $network = ''; + /** + * The GCP zone the Uptime check should egress from. Only respected for + * internal Uptime checks, where internal_network is specified. + * + * Generated from protobuf field string gcp_zone = 4; + */ + protected $gcp_zone = ''; + /** + * The GCP project ID where the internal checker lives. Not necessary + * the same as the Metrics Scope project. + * + * Generated from protobuf field string peer_project_id = 6; + */ + protected $peer_project_id = ''; + /** + * The current operational state of the internal checker. + * + * Generated from protobuf field .google.monitoring.v3.InternalChecker.State state = 7; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A unique resource name for this InternalChecker. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for + * the Uptime check config associated with the internal checker. + * @type string $display_name + * The checker's human-readable name. The display name + * should be unique within a Cloud Monitoring Metrics Scope in order to make + * it easier to identify; however, uniqueness is not enforced. + * @type string $network + * The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the + * internal resource lives (ex: "default"). + * @type string $gcp_zone + * The GCP zone the Uptime check should egress from. Only respected for + * internal Uptime checks, where internal_network is specified. + * @type string $peer_project_id + * The GCP project ID where the internal checker lives. Not necessary + * the same as the Metrics Scope project. + * @type int $state + * The current operational state of the internal checker. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * A unique resource name for this InternalChecker. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for + * the Uptime check config associated with the internal checker. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A unique resource name for this InternalChecker. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for + * the Uptime check config associated with the internal checker. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The checker's human-readable name. The display name + * should be unique within a Cloud Monitoring Metrics Scope in order to make + * it easier to identify; however, uniqueness is not enforced. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The checker's human-readable name. The display name + * should be unique within a Cloud Monitoring Metrics Scope in order to make + * it easier to identify; however, uniqueness is not enforced. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the + * internal resource lives (ex: "default"). + * + * Generated from protobuf field string network = 3; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the + * internal resource lives (ex: "default"). + * + * Generated from protobuf field string network = 3; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The GCP zone the Uptime check should egress from. Only respected for + * internal Uptime checks, where internal_network is specified. + * + * Generated from protobuf field string gcp_zone = 4; + * @return string + */ + public function getGcpZone() + { + return $this->gcp_zone; + } + + /** + * The GCP zone the Uptime check should egress from. Only respected for + * internal Uptime checks, where internal_network is specified. + * + * Generated from protobuf field string gcp_zone = 4; + * @param string $var + * @return $this + */ + public function setGcpZone($var) + { + GPBUtil::checkString($var, True); + $this->gcp_zone = $var; + + return $this; + } + + /** + * The GCP project ID where the internal checker lives. Not necessary + * the same as the Metrics Scope project. + * + * Generated from protobuf field string peer_project_id = 6; + * @return string + */ + public function getPeerProjectId() + { + return $this->peer_project_id; + } + + /** + * The GCP project ID where the internal checker lives. Not necessary + * the same as the Metrics Scope project. + * + * Generated from protobuf field string peer_project_id = 6; + * @param string $var + * @return $this + */ + public function setPeerProjectId($var) + { + GPBUtil::checkString($var, True); + $this->peer_project_id = $var; + + return $this; + } + + /** + * The current operational state of the internal checker. + * + * Generated from protobuf field .google.monitoring.v3.InternalChecker.State state = 7; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current operational state of the internal checker. + * + * Generated from protobuf field .google.monitoring.v3.InternalChecker.State state = 7; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\InternalChecker\State::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker/State.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker/State.php new file mode 100644 index 000000000000..d006a60c773f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/InternalChecker/State.php @@ -0,0 +1,74 @@ +google.monitoring.v3.InternalChecker.State + */ +class State +{ + /** + * An internal checker should never be in the unspecified state. + * + * Generated from protobuf enum UNSPECIFIED = 0; + */ + const UNSPECIFIED = 0; + /** + * The checker is being created, provisioned, and configured. A checker in + * this state can be returned by `ListInternalCheckers` or + * `GetInternalChecker`, as well as by examining the [long running + * Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) + * that created it. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The checker is running and available for use. A checker in this state + * can be returned by `ListInternalCheckers` or `GetInternalChecker` as + * well as by examining the [long running + * Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) + * that created it. + * If a checker is being torn down, it is neither visible nor usable, so + * there is no "deleting" or "down" state. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + + private static $valueToName = [ + self::UNSPECIFIED => 'UNSPECIFIED', + self::CREATING => 'CREATING', + self::RUNNING => 'RUNNING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Monitoring\V3\InternalChecker_State::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/LabelValue.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/LabelValue.php new file mode 100644 index 000000000000..3a66a26a4359 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/LabelValue.php @@ -0,0 +1,141 @@ +google.monitoring.v3.LabelValue + */ +class LabelValue extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $bool_value + * A bool label value. + * @type int|string $int64_value + * An int64 label value. + * @type string $string_value + * A string label value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * A bool label value. + * + * Generated from protobuf field bool bool_value = 1; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(1); + } + + public function hasBoolValue() + { + return $this->hasOneof(1); + } + + /** + * A bool label value. + * + * Generated from protobuf field bool bool_value = 1; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * An int64 label value. + * + * Generated from protobuf field int64 int64_value = 2; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(2); + } + + public function hasInt64Value() + { + return $this->hasOneof(2); + } + + /** + * An int64 label value. + * + * Generated from protobuf field int64 int64_value = 2; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A string label value. + * + * Generated from protobuf field string string_value = 3; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(3); + } + + public function hasStringValue() + { + return $this->hasOneof(3); + } + + /** + * A string label value. + * + * Generated from protobuf field string string_value = 3; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesRequest.php new file mode 100644 index 000000000000..cf35d504f674 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesRequest.php @@ -0,0 +1,298 @@ +google.monitoring.v3.ListAlertPoliciesRequest + */ +class ListAlertPoliciesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. The maximum number of results to return in a single response. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * + * @return \Google\Cloud\Monitoring\V3\ListAlertPoliciesRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * @type string $filter + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type string $order_by + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type int $page_size + * Optional. The maximum number of results to return in a single response. + * @type string $page_token + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return in a single response. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return in a single response. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesResponse.php new file mode 100644 index 000000000000..45d31688ec1b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListAlertPoliciesResponse.php @@ -0,0 +1,147 @@ +google.monitoring.v3.ListAlertPoliciesResponse + */ +class ListAlertPoliciesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The returned alert policies. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy alert_policies = 3; + */ + private $alert_policies; + /** + * If there might be more results than were returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The total number of alert policies in all pages. This number is only an + * estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + */ + protected $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\AlertPolicy>|\Google\Protobuf\Internal\RepeatedField $alert_policies + * The returned alert policies. + * @type string $next_page_token + * If there might be more results than were returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * @type int $total_size + * The total number of alert policies in all pages. This number is only an + * estimate, and may change in subsequent pages. https://aip.dev/158 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * The returned alert policies. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy alert_policies = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAlertPolicies() + { + return $this->alert_policies; + } + + /** + * The returned alert policies. + * + * Generated from protobuf field repeated .google.monitoring.v3.AlertPolicy alert_policies = 3; + * @param array<\Google\Cloud\Monitoring\V3\AlertPolicy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAlertPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy::class); + $this->alert_policies = $arr; + + return $this; + } + + /** + * If there might be more results than were returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there might be more results than were returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of alert policies in all pages. This number is only an + * estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of alert policies in all pages. This number is only an + * estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersRequest.php new file mode 100644 index 000000000000..876c5364c1a1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersRequest.php @@ -0,0 +1,277 @@ +google.monitoring.v3.ListGroupMembersRequest + */ +class ListGroupMembersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group whose members are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + /** + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * `resource.type = "gce_instance"` + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 6; + */ + protected $interval = null; + + /** + * @param string $name Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Please see {@see GroupServiceClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\ListGroupMembersRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The group whose members are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @type int $page_size + * A positive number that is the maximum number of results to return. + * @type string $page_token + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @type string $filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * `resource.type = "gce_instance"` + * @type \Google\Cloud\Monitoring\V3\TimeInterval $interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group whose members are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The group whose members are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * `resource.type = "gce_instance"` + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * `resource.type = "gce_instance"` + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 6; + * @return \Google\Cloud\Monitoring\V3\TimeInterval|null + */ + public function getInterval() + { + return $this->interval; + } + + public function hasInterval() + { + return isset($this->interval); + } + + public function clearInterval() + { + unset($this->interval); + } + + /** + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 6; + * @param \Google\Cloud\Monitoring\V3\TimeInterval $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeInterval::class); + $this->interval = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersResponse.php new file mode 100644 index 000000000000..8cfc0e8fcd34 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupMembersResponse.php @@ -0,0 +1,143 @@ +google.monitoring.v3.ListGroupMembersResponse + */ +class ListGroupMembersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A set of monitored resources in the group. + * + * Generated from protobuf field repeated .google.api.MonitoredResource members = 1; + */ + private $members; + /** + * If there are more results than have been returned, then this field is + * set to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The total number of elements matching this request. + * + * Generated from protobuf field int32 total_size = 3; + */ + protected $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Api\MonitoredResource>|\Google\Protobuf\Internal\RepeatedField $members + * A set of monitored resources in the group. + * @type string $next_page_token + * If there are more results than have been returned, then this field is + * set to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * @type int $total_size + * The total number of elements matching this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * A set of monitored resources in the group. + * + * Generated from protobuf field repeated .google.api.MonitoredResource members = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMembers() + { + return $this->members; + } + + /** + * A set of monitored resources in the group. + * + * Generated from protobuf field repeated .google.api.MonitoredResource members = 1; + * @param array<\Google\Api\MonitoredResource>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMembers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResource::class); + $this->members = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is + * set to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is + * set to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of elements matching this request. + * + * Generated from protobuf field int32 total_size = 3; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of elements matching this request. + * + * Generated from protobuf field int32 total_size = 3; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsRequest.php new file mode 100644 index 000000000000..7203ea371000 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsRequest.php @@ -0,0 +1,316 @@ +google.monitoring.v3.ListGroupsRequest + */ +class ListGroupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 5; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 6; + */ + protected $page_token = ''; + protected $filter; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * @return \Google\Cloud\Monitoring\V3\ListGroupsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $children_of_group + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @type string $ancestors_of_group + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @type string $descendants_of_group + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @type int $page_size + * A positive number that is the maximum number of results to return. + * @type string $page_token + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * + * Generated from protobuf field string children_of_group = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getChildrenOfGroup() + { + return $this->readOneof(2); + } + + public function hasChildrenOfGroup() + { + return $this->hasOneof(2); + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * + * Generated from protobuf field string children_of_group = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setChildrenOfGroup($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * + * Generated from protobuf field string ancestors_of_group = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getAncestorsOfGroup() + { + return $this->readOneof(3); + } + + public function hasAncestorsOfGroup() + { + return $this->hasOneof(3); + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * + * Generated from protobuf field string ancestors_of_group = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAncestorsOfGroup($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * + * Generated from protobuf field string descendants_of_group = 4 [(.google.api.resource_reference) = { + * @return string + */ + public function getDescendantsOfGroup() + { + return $this->readOneof(4); + } + + public function hasDescendantsOfGroup() + { + return $this->hasOneof(4); + } + + /** + * A group name. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * + * Generated from protobuf field string descendants_of_group = 4 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDescendantsOfGroup($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 5; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 5; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 6; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 6; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * @return string + */ + public function getFilter() + { + return $this->whichOneof("filter"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsResponse.php new file mode 100644 index 000000000000..98e3257f20aa --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListGroupsResponse.php @@ -0,0 +1,109 @@ +google.monitoring.v3.ListGroupsResponse + */ +class ListGroupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The groups that match the specified filters. + * + * Generated from protobuf field repeated .google.monitoring.v3.Group group = 1; + */ + private $group; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\Group>|\Google\Protobuf\Internal\RepeatedField $group + * The groups that match the specified filters. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * The groups that match the specified filters. + * + * Generated from protobuf field repeated .google.monitoring.v3.Group group = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroup() + { + return $this->group; + } + + /** + * The groups that match the specified filters. + * + * Generated from protobuf field repeated .google.monitoring.v3.Group group = 1; + * @param array<\Google\Cloud\Monitoring\V3\Group>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroup($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Group::class); + $this->group = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsRequest.php new file mode 100644 index 000000000000..d719fdc45ddd --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsRequest.php @@ -0,0 +1,242 @@ +google.monitoring.v3.ListMetricDescriptorsRequest + */ +class ListMetricDescriptorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * metric.type = starts_with("custom.googleapis.com/") + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * @return \Google\Cloud\Monitoring\V3\ListMetricDescriptorsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $filter + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * metric.type = starts_with("custom.googleapis.com/") + * @type int $page_size + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * @type string $page_token + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * metric.type = starts_with("custom.googleapis.com/") + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * metric.type = starts_with("custom.googleapis.com/") + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsResponse.php new file mode 100644 index 000000000000..4ea2039e212c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMetricDescriptorsResponse.php @@ -0,0 +1,113 @@ +google.monitoring.v3.ListMetricDescriptorsResponse + */ +class ListMetricDescriptorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The metric descriptors that are available to the project + * and that match the value of `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metric_descriptors = 1; + */ + private $metric_descriptors; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Api\MetricDescriptor>|\Google\Protobuf\Internal\RepeatedField $metric_descriptors + * The metric descriptors that are available to the project + * and that match the value of `filter`, if present. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * The metric descriptors that are available to the project + * and that match the value of `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metric_descriptors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetricDescriptors() + { + return $this->metric_descriptors; + } + + /** + * The metric descriptors that are available to the project + * and that match the value of `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MetricDescriptor metric_descriptors = 1; + * @param array<\Google\Api\MetricDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetricDescriptors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class); + $this->metric_descriptors = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsRequest.php new file mode 100644 index 000000000000..14696bd981c1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsRequest.php @@ -0,0 +1,222 @@ +google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + */ +class ListMonitoredResourceDescriptorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * resource.type = starts_with("gce_") AND resource.label:id + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * @return \Google\Cloud\Monitoring\V3\ListMonitoredResourceDescriptorsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * resource.type = starts_with("gce_") AND resource.label:id + * @type int $page_size + * A positive number that is the maximum number of results to return. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * resource.type = starts_with("gce_") AND resource.label:id + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * resource.type = starts_with("gce_") AND resource.label:id + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A positive number that is the maximum number of results to return. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsResponse.php new file mode 100644 index 000000000000..07992037c864 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListMonitoredResourceDescriptorsResponse.php @@ -0,0 +1,113 @@ +google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + */ +class ListMonitoredResourceDescriptorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The monitored resource descriptors that are available to this project + * and that match `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor resource_descriptors = 1; + */ + private $resource_descriptors; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Api\MonitoredResourceDescriptor>|\Google\Protobuf\Internal\RepeatedField $resource_descriptors + * The monitored resource descriptors that are available to this project + * and that match `filter`, if present. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * The monitored resource descriptors that are available to this project + * and that match `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor resource_descriptors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResourceDescriptors() + { + return $this->resource_descriptors; + } + + /** + * The monitored resource descriptors that are available to this project + * and that match `filter`, if present. + * + * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor resource_descriptors = 1; + * @param array<\Google\Api\MonitoredResourceDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResourceDescriptors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class); + $this->resource_descriptors = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsRequest.php new file mode 100644 index 000000000000..ef7d9522e6f2 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsRequest.php @@ -0,0 +1,206 @@ +google.monitoring.v3.ListNotificationChannelDescriptorsRequest + */ +class ListNotificationChannelDescriptorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * + * @return \Google\Cloud\Monitoring\V3\ListNotificationChannelDescriptorsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * @type int $page_size + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @type string $page_token + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * projects/[PROJECT_ID_OR_NUMBER] + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * + * Generated from protobuf field string name = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsResponse.php new file mode 100644 index 000000000000..93034ae15999 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelDescriptorsResponse.php @@ -0,0 +1,117 @@ +google.monitoring.v3.ListNotificationChannelDescriptorsResponse + */ +class ListNotificationChannelDescriptorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The monitored resource descriptors supported for the specified + * project, optionally filtered. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannelDescriptor channel_descriptors = 1; + */ + private $channel_descriptors; + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\NotificationChannelDescriptor>|\Google\Protobuf\Internal\RepeatedField $channel_descriptors + * The monitored resource descriptors supported for the specified + * project, optionally filtered. + * @type string $next_page_token + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * The monitored resource descriptors supported for the specified + * project, optionally filtered. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannelDescriptor channel_descriptors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannelDescriptors() + { + return $this->channel_descriptors; + } + + /** + * The monitored resource descriptors supported for the specified + * project, optionally filtered. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannelDescriptor channel_descriptors = 1; + * @param array<\Google\Cloud\Monitoring\V3\NotificationChannelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelDescriptors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannelDescriptor::class); + $this->channel_descriptors = $arr; + + return $this; + } + + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsRequest.php new file mode 100644 index 000000000000..ec2c80372ea3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsRequest.php @@ -0,0 +1,307 @@ +google.monitoring.v3.ListNotificationChannelsRequest + */ +class ListNotificationChannelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * + * @return \Google\Cloud\Monitoring\V3\ListNotificationChannelsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * @type string $filter + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type string $order_by + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type int $page_size + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @type string $page_token + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * + * Generated from protobuf field string name = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string filter = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * + * Generated from protobuf field string order_by = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsResponse.php new file mode 100644 index 000000000000..28dc01fb0af2 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListNotificationChannelsResponse.php @@ -0,0 +1,151 @@ +google.monitoring.v3.ListNotificationChannelsResponse + */ +class ListNotificationChannelsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The notification channels defined for the specified project. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannel notification_channels = 3; + */ + private $notification_channels; + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The total number of notification channels in all pages. This number is only + * an estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + */ + protected $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\NotificationChannel>|\Google\Protobuf\Internal\RepeatedField $notification_channels + * The notification channels defined for the specified project. + * @type string $next_page_token + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * @type int $total_size + * The total number of notification channels in all pages. This number is only + * an estimate, and may change in subsequent pages. https://aip.dev/158 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * The notification channels defined for the specified project. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannel notification_channels = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNotificationChannels() + { + return $this->notification_channels; + } + + /** + * The notification channels defined for the specified project. + * + * Generated from protobuf field repeated .google.monitoring.v3.NotificationChannel notification_channels = 3; + * @param array<\Google\Cloud\Monitoring\V3\NotificationChannel>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNotificationChannels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannel::class); + $this->notification_channels = $arr; + + return $this; + } + + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If not empty, indicates that there may be more results that match + * the request. Use the value in the `page_token` field in a + * subsequent request to fetch the next set of results. If empty, + * all results have been returned. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of notification channels in all pages. This number is only + * an estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of notification channels in all pages. This number is only + * an estimate, and may change in subsequent pages. https://aip.dev/158 + * + * Generated from protobuf field int32 total_size = 4; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesRequest.php new file mode 100644 index 000000000000..19128d58f56f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesRequest.php @@ -0,0 +1,257 @@ +google.monitoring.v3.ListServiceLevelObjectivesRequest + */ +class ListServiceLevelObjectivesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * A filter specifying what `ServiceLevelObjective`s to return. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + /** + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 5; + */ + protected $view = 0; + + /** + * @param string $parent Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * Please see {@see ServiceMonitoringServiceClient::serviceName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\ListServiceLevelObjectivesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @type string $filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @type int $page_size + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @type int $view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A filter specifying what `ServiceLevelObjective`s to return. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter specifying what `ServiceLevelObjective`s to return. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 5; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective.View view = 5; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\ServiceLevelObjective\View::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesResponse.php new file mode 100644 index 000000000000..8e9d2ead1abf --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServiceLevelObjectivesResponse.php @@ -0,0 +1,109 @@ +google.monitoring.v3.ListServiceLevelObjectivesResponse + */ +class ListServiceLevelObjectivesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `ServiceLevelObjective`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceLevelObjective service_level_objectives = 1; + */ + private $service_level_objectives; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\ServiceLevelObjective>|\Google\Protobuf\Internal\RepeatedField $service_level_objectives + * The `ServiceLevelObjective`s matching the specified filter. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * The `ServiceLevelObjective`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceLevelObjective service_level_objectives = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServiceLevelObjectives() + { + return $this->service_level_objectives; + } + + /** + * The `ServiceLevelObjective`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceLevelObjective service_level_objectives = 1; + * @param array<\Google\Cloud\Monitoring\V3\ServiceLevelObjective>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServiceLevelObjectives($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\ServiceLevelObjective::class); + $this->service_level_objectives = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesRequest.php new file mode 100644 index 000000000000..795a4e8e34eb --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesRequest.php @@ -0,0 +1,275 @@ +google.monitoring.v3.ListServicesRequest + */ +class ListServicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * + * @return \Google\Cloud\Monitoring\V3\ListServicesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @type string $filter + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * @type int $page_size + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesResponse.php new file mode 100644 index 000000000000..4359a2689b2e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListServicesResponse.php @@ -0,0 +1,109 @@ +google.monitoring.v3.ListServicesResponse + */ +class ListServicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The `Service`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.Service services = 1; + */ + private $services; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\Service>|\Google\Protobuf\Internal\RepeatedField $services + * The `Service`s matching the specified filter. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * The `Service`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.Service services = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getServices() + { + return $this->services; + } + + /** + * The `Service`s matching the specified filter. + * + * Generated from protobuf field repeated .google.monitoring.v3.Service services = 1; + * @param array<\Google\Cloud\Monitoring\V3\Service>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setServices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Service::class); + $this->services = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesRequest.php new file mode 100644 index 000000000000..ff92a8e233fa --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesRequest.php @@ -0,0 +1,252 @@ +google.monitoring.v3.ListSnoozesRequest + */ +class ListSnoozesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * * `interval.start_time` + * * `interval.end_time` + * For example: + * ``` + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * ``` + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * + * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * + * Generated from protobuf field string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * Please see {@see SnoozeServiceClient::workspaceName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\ListSnoozesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $filter + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * * `interval.start_time` + * * `interval.end_time` + * For example: + * ``` + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * ``` + * @type int $page_size + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * @type string $page_token + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SnoozeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * * `interval.start_time` + * * `interval.end_time` + * For example: + * ``` + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * ``` + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * * `interval.start_time` + * * `interval.end_time` + * For example: + * ``` + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * ``` + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * + * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * + * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * + * Generated from protobuf field string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * + * Generated from protobuf field string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesResponse.php new file mode 100644 index 000000000000..e22e8db840ef --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListSnoozesResponse.php @@ -0,0 +1,106 @@ +google.monitoring.v3.ListSnoozesResponse + */ +class ListSnoozesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * `Snooze`s matching this list call. + * + * Generated from protobuf field repeated .google.monitoring.v3.Snooze snoozes = 1; + */ + private $snoozes; + /** + * Page token for repeated calls to `ListSnoozes`, to fetch additional pages + * of results. If this is empty or missing, there are no more pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\Snooze>|\Google\Protobuf\Internal\RepeatedField $snoozes + * `Snooze`s matching this list call. + * @type string $next_page_token + * Page token for repeated calls to `ListSnoozes`, to fetch additional pages + * of results. If this is empty or missing, there are no more pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SnoozeService::initOnce(); + parent::__construct($data); + } + + /** + * `Snooze`s matching this list call. + * + * Generated from protobuf field repeated .google.monitoring.v3.Snooze snoozes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSnoozes() + { + return $this->snoozes; + } + + /** + * `Snooze`s matching this list call. + * + * Generated from protobuf field repeated .google.monitoring.v3.Snooze snoozes = 1; + * @param array<\Google\Cloud\Monitoring\V3\Snooze>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSnoozes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Snooze::class); + $this->snoozes = $arr; + + return $this; + } + + /** + * Page token for repeated calls to `ListSnoozes`, to fetch additional pages + * of results. If this is empty or missing, there are no more pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Page token for repeated calls to `ListSnoozes`, to fetch additional pages + * of results. If this is empty or missing, there are no more pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest.php new file mode 100644 index 000000000000..0b123db098c9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest.php @@ -0,0 +1,501 @@ +google.monitoring.v3.ListTimeSeriesRequest + */ +class ListTimeSeriesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * + * Generated from protobuf field string name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $interval = null; + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation aggregation = 5; + */ + protected $aggregation = null; + /** + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation secondary_aggregation = 11; + */ + protected $secondary_aggregation = null; + /** + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * + * Generated from protobuf field string order_by = 6; + */ + protected $order_by = ''; + /** + * Required. Specifies which information is returned about the time series. + * + * Generated from protobuf field .google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView view = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $view = 0; + /** + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * + * Generated from protobuf field int32 page_size = 8; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 9; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * Please see {@see MetricServiceClient::workspaceName()} for help formatting this field. + * @param string $filter Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param \Google\Cloud\Monitoring\V3\TimeInterval $interval Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @param int $view Required. Specifies which information is returned about the time series. + * For allowed values, use constants defined on {@see \Google\Cloud\Monitoring\V3\ListTimeSeriesRequest\TimeSeriesView} + * + * @return \Google\Cloud\Monitoring\V3\ListTimeSeriesRequest + * + * @experimental + */ + public static function build(string $name, string $filter, \Google\Cloud\Monitoring\V3\TimeInterval $interval, int $view): self + { + return (new self()) + ->setName($name) + ->setFilter($filter) + ->setInterval($interval) + ->setView($view); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @type string $filter + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @type \Google\Cloud\Monitoring\V3\TimeInterval $interval + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @type \Google\Cloud\Monitoring\V3\Aggregation $aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @type \Google\Cloud\Monitoring\V3\Aggregation $secondary_aggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @type string $order_by + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @type int $view + * Required. Specifies which information is returned about the time series. + * @type int $page_size + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * + * Generated from protobuf field string name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * + * Generated from protobuf field string name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\TimeInterval|null + */ + public function getInterval() + { + return $this->interval; + } + + public function hasInterval() + { + return isset($this->interval); + } + + public function clearInterval() + { + unset($this->interval); + } + + /** + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\TimeInterval $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeInterval::class); + $this->interval = $var; + + return $this; + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation aggregation = 5; + * @return \Google\Cloud\Monitoring\V3\Aggregation|null + */ + public function getAggregation() + { + return $this->aggregation; + } + + public function hasAggregation() + { + return isset($this->aggregation); + } + + public function clearAggregation() + { + unset($this->aggregation); + } + + /** + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation aggregation = 5; + * @param \Google\Cloud\Monitoring\V3\Aggregation $var + * @return $this + */ + public function setAggregation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Aggregation::class); + $this->aggregation = $var; + + return $this; + } + + /** + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation secondary_aggregation = 11; + * @return \Google\Cloud\Monitoring\V3\Aggregation|null + */ + public function getSecondaryAggregation() + { + return $this->secondary_aggregation; + } + + public function hasSecondaryAggregation() + { + return isset($this->secondary_aggregation); + } + + public function clearSecondaryAggregation() + { + unset($this->secondary_aggregation); + } + + /** + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * + * Generated from protobuf field .google.monitoring.v3.Aggregation secondary_aggregation = 11; + * @param \Google\Cloud\Monitoring\V3\Aggregation $var + * @return $this + */ + public function setSecondaryAggregation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Aggregation::class); + $this->secondary_aggregation = $var; + + return $this; + } + + /** + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * + * Generated from protobuf field string order_by = 6; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * + * Generated from protobuf field string order_by = 6; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Required. Specifies which information is returned about the time series. + * + * Generated from protobuf field .google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView view = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Required. Specifies which information is returned about the time series. + * + * Generated from protobuf field .google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView view = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\ListTimeSeriesRequest\TimeSeriesView::class); + $this->view = $var; + + return $this; + } + + /** + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * + * Generated from protobuf field int32 page_size = 8; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * + * Generated from protobuf field int32 page_size = 8; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 9; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 9; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest/TimeSeriesView.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest/TimeSeriesView.php new file mode 100644 index 000000000000..cd4d2c1bcc55 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesRequest/TimeSeriesView.php @@ -0,0 +1,59 @@ +google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView + */ +class TimeSeriesView +{ + /** + * Returns the identity of the metric(s), the time series, + * and the time series data. + * + * Generated from protobuf enum FULL = 0; + */ + const FULL = 0; + /** + * Returns the identity of the metric and the time series resource, + * but not the time series data. + * + * Generated from protobuf enum HEADERS = 1; + */ + const HEADERS = 1; + + private static $valueToName = [ + self::FULL => 'FULL', + self::HEADERS => 'HEADERS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TimeSeriesView::class, \Google\Cloud\Monitoring\V3\ListTimeSeriesRequest_TimeSeriesView::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesResponse.php new file mode 100644 index 000000000000..f2d874bd3478 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListTimeSeriesResponse.php @@ -0,0 +1,201 @@ +google.monitoring.v3.ListTimeSeriesResponse + */ +class ListTimeSeriesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * One or more time series that match the filter included in the request. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 1; + */ + private $time_series; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. + * + * Generated from protobuf field repeated .google.rpc.Status execution_errors = 3; + */ + private $execution_errors; + /** + * The unit in which all `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * If different `time_series` have different units (for example, because they + * come from different metric types, or a unit is absent), then `unit` will be + * "{not_a_unit}". + * + * Generated from protobuf field string unit = 5; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\TimeSeries>|\Google\Protobuf\Internal\RepeatedField $time_series + * One or more time series that match the filter included in the request. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $execution_errors + * Query execution errors that may have caused the time series data returned + * to be incomplete. + * @type string $unit + * The unit in which all `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * If different `time_series` have different units (for example, because they + * come from different metric types, or a unit is absent), then `unit` will be + * "{not_a_unit}". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * One or more time series that match the filter included in the request. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeSeries() + { + return $this->time_series; + } + + /** + * One or more time series that match the filter included in the request. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeries time_series = 1; + * @param array<\Google\Cloud\Monitoring\V3\TimeSeries>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeSeries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeries::class); + $this->time_series = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, + * use that value as `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. + * + * Generated from protobuf field repeated .google.rpc.Status execution_errors = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExecutionErrors() + { + return $this->execution_errors; + } + + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. + * + * Generated from protobuf field repeated .google.rpc.Status execution_errors = 3; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExecutionErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->execution_errors = $arr; + + return $this; + } + + /** + * The unit in which all `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * If different `time_series` have different units (for example, because they + * come from different metric types, or a unit is absent), then `unit` will be + * "{not_a_unit}". + * + * Generated from protobuf field string unit = 5; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * The unit in which all `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * If different `time_series` have different units (for example, because they + * come from different metric types, or a unit is absent), then `unit` will be + * "{not_a_unit}". + * + * Generated from protobuf field string unit = 5; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsRequest.php new file mode 100644 index 000000000000..0718e498334a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsRequest.php @@ -0,0 +1,230 @@ +google.monitoring.v3.ListUptimeCheckConfigsRequest + */ +class ListUptimeCheckConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * @return \Google\Cloud\Monitoring\V3\ListUptimeCheckConfigsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $filter + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * @type int $page_size + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsResponse.php new file mode 100644 index 000000000000..f12354762fe7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckConfigsResponse.php @@ -0,0 +1,155 @@ +google.monitoring.v3.ListUptimeCheckConfigsResponse + */ +class ListUptimeCheckConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The returned Uptime check configurations. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig uptime_check_configs = 1; + */ + private $uptime_check_configs; + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The total number of Uptime check configurations for the project, + * irrespective of any pagination. + * + * Generated from protobuf field int32 total_size = 3; + */ + protected $total_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig>|\Google\Protobuf\Internal\RepeatedField $uptime_check_configs + * The returned Uptime check configurations. + * @type string $next_page_token + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * @type int $total_size + * The total number of Uptime check configurations for the project, + * irrespective of any pagination. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * The returned Uptime check configurations. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig uptime_check_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUptimeCheckConfigs() + { + return $this->uptime_check_configs; + } + + /** + * The returned Uptime check configurations. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig uptime_check_configs = 1; + * @param array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUptimeCheckConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\UptimeCheckConfig::class); + $this->uptime_check_configs = $arr; + + return $this; + } + + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The total number of Uptime check configurations for the project, + * irrespective of any pagination. + * + * Generated from protobuf field int32 total_size = 3; + * @return int + */ + public function getTotalSize() + { + return $this->total_size; + } + + /** + * The total number of Uptime check configurations for the project, + * irrespective of any pagination. + * + * Generated from protobuf field int32 total_size = 3; + * @param int $var + * @return $this + */ + public function setTotalSize($var) + { + GPBUtil::checkInt32($var); + $this->total_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsRequest.php new file mode 100644 index 000000000000..f2d106e88980 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsRequest.php @@ -0,0 +1,129 @@ +google.monitoring.v3.ListUptimeCheckIpsRequest + */ +class ListUptimeCheckIpsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $page_size + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsResponse.php new file mode 100644 index 000000000000..26da2fcdd61f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ListUptimeCheckIpsResponse.php @@ -0,0 +1,125 @@ +google.monitoring.v3.ListUptimeCheckIpsResponse + */ +class ListUptimeCheckIpsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The returned list of IP addresses (including region and location) that the + * checkers run from. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckIp uptime_check_ips = 1; + */ + private $uptime_check_ips; + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\UptimeCheckIp>|\Google\Protobuf\Internal\RepeatedField $uptime_check_ips + * The returned list of IP addresses (including region and location) that the + * checkers run from. + * @type string $next_page_token + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * NOTE: this field is not yet implemented + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * The returned list of IP addresses (including region and location) that the + * checkers run from. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckIp uptime_check_ips = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUptimeCheckIps() + { + return $this->uptime_check_ips; + } + + /** + * The returned list of IP addresses (including region and location) that the + * checkers run from. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckIp uptime_check_ips = 1; + * @param array<\Google\Cloud\Monitoring\V3\UptimeCheckIp>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUptimeCheckIps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\UptimeCheckIp::class); + $this->uptime_check_ips = $arr; + + return $this; + } + + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * This field represents the pagination token to retrieve the next page of + * results. If the value is empty, it means no further results for the + * request. To retrieve the next page of results, the value of the + * next_page_token is passed to the subsequent List method call (in the + * request message's page_token field). + * NOTE: this field is not yet implemented + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/MutationRecord.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/MutationRecord.php new file mode 100644 index 000000000000..73a1f82bce89 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/MutationRecord.php @@ -0,0 +1,111 @@ +google.monitoring.v3.MutationRecord + */ +class MutationRecord extends \Google\Protobuf\Internal\Message +{ + /** + * When the change occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp mutate_time = 1; + */ + protected $mutate_time = null; + /** + * The email address of the user making the change. + * + * Generated from protobuf field string mutated_by = 2; + */ + protected $mutated_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $mutate_time + * When the change occurred. + * @type string $mutated_by + * The email address of the user making the change. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MutationRecord::initOnce(); + parent::__construct($data); + } + + /** + * When the change occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp mutate_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getMutateTime() + { + return $this->mutate_time; + } + + public function hasMutateTime() + { + return isset($this->mutate_time); + } + + public function clearMutateTime() + { + unset($this->mutate_time); + } + + /** + * When the change occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp mutate_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setMutateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->mutate_time = $var; + + return $this; + } + + /** + * The email address of the user making the change. + * + * Generated from protobuf field string mutated_by = 2; + * @return string + */ + public function getMutatedBy() + { + return $this->mutated_by; + } + + /** + * The email address of the user making the change. + * + * Generated from protobuf field string mutated_by = 2; + * @param string $var + * @return $this + */ + public function setMutatedBy($var) + { + GPBUtil::checkString($var, True); + $this->mutated_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel.php new file mode 100644 index 000000000000..a68ec145b595 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel.php @@ -0,0 +1,594 @@ +google.monitoring.v3.NotificationChannel + */ +class NotificationChannel extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the notification channel. This field matches the + * value of the + * [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] + * field. + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Identifier. The full REST resource name for this channel. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * The `[CHANNEL_ID]` is automatically assigned by the server on creation. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * An optional human-readable name for this notification channel. It is + * recommended that you specify a non-empty and unique name in order to + * make it easier to identify the channels in your project, though this is + * not enforced. The display name is limited to 512 Unicode characters. + * + * Generated from protobuf field string display_name = 3; + */ + protected $display_name = ''; + /** + * An optional human-readable description of this notification channel. This + * description may provide additional details, beyond the display + * name, for the channel. This may not exceed 1024 Unicode characters. + * + * Generated from protobuf field string description = 4; + */ + protected $description = ''; + /** + * Configuration fields that define the channel and its behavior. The + * permissible and required labels are specified in the + * [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] + * of the `NotificationChannelDescriptor` corresponding to the `type` field. + * + * Generated from protobuf field map labels = 5; + */ + private $labels; + /** + * User-supplied key/value data that does not need to conform to + * the corresponding `NotificationChannelDescriptor`'s schema, unlike + * the `labels` field. This field is intended to be used for organizing + * and identifying the `NotificationChannel` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 8; + */ + private $user_labels; + /** + * Indicates whether this channel has been verified or not. On a + * [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * or + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation, this field is expected to be populated. + * If the value is `UNVERIFIED`, then it indicates that the channel is + * non-functioning (it both requires verification and lacks verification); + * otherwise, it is assumed that the channel works. + * If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that + * the channel is of a type that does not require verification or that + * this specific channel has been exempted from verification because it was + * created prior to verification being required for channels of this type. + * This field cannot be modified using a standard + * [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + * operation. To change the value of this field, you must call + * [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel.VerificationStatus verification_status = 9; + */ + protected $verification_status = 0; + /** + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 11; + */ + protected $enabled = null; + /** + * Record of the creation of this channel. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 12; + */ + protected $creation_record = null; + /** + * Records of the modification of this channel. + * + * Generated from protobuf field repeated .google.monitoring.v3.MutationRecord mutation_records = 13; + */ + private $mutation_records; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * The type of the notification channel. This field matches the + * value of the + * [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] + * field. + * @type string $name + * Identifier. The full REST resource name for this channel. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * The `[CHANNEL_ID]` is automatically assigned by the server on creation. + * @type string $display_name + * An optional human-readable name for this notification channel. It is + * recommended that you specify a non-empty and unique name in order to + * make it easier to identify the channels in your project, though this is + * not enforced. The display name is limited to 512 Unicode characters. + * @type string $description + * An optional human-readable description of this notification channel. This + * description may provide additional details, beyond the display + * name, for the channel. This may not exceed 1024 Unicode characters. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Configuration fields that define the channel and its behavior. The + * permissible and required labels are specified in the + * [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] + * of the `NotificationChannelDescriptor` corresponding to the `type` field. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * User-supplied key/value data that does not need to conform to + * the corresponding `NotificationChannelDescriptor`'s schema, unlike + * the `labels` field. This field is intended to be used for organizing + * and identifying the `NotificationChannel` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * @type int $verification_status + * Indicates whether this channel has been verified or not. On a + * [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * or + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation, this field is expected to be populated. + * If the value is `UNVERIFIED`, then it indicates that the channel is + * non-functioning (it both requires verification and lacks verification); + * otherwise, it is assumed that the channel works. + * If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that + * the channel is of a type that does not require verification or that + * this specific channel has been exempted from verification because it was + * created prior to verification being required for channels of this type. + * This field cannot be modified using a standard + * [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + * operation. To change the value of this field, you must call + * [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. + * @type \Google\Protobuf\BoolValue $enabled + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * @type \Google\Cloud\Monitoring\V3\MutationRecord $creation_record + * Record of the creation of this channel. + * @type array<\Google\Cloud\Monitoring\V3\MutationRecord>|\Google\Protobuf\Internal\RepeatedField $mutation_records + * Records of the modification of this channel. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Notification::initOnce(); + parent::__construct($data); + } + + /** + * The type of the notification channel. This field matches the + * value of the + * [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] + * field. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type of the notification channel. This field matches the + * value of the + * [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] + * field. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Identifier. The full REST resource name for this channel. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * The `[CHANNEL_ID]` is automatically assigned by the server on creation. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The full REST resource name for this channel. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * The `[CHANNEL_ID]` is automatically assigned by the server on creation. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * An optional human-readable name for this notification channel. It is + * recommended that you specify a non-empty and unique name in order to + * make it easier to identify the channels in your project, though this is + * not enforced. The display name is limited to 512 Unicode characters. + * + * Generated from protobuf field string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * An optional human-readable name for this notification channel. It is + * recommended that you specify a non-empty and unique name in order to + * make it easier to identify the channels in your project, though this is + * not enforced. The display name is limited to 512 Unicode characters. + * + * Generated from protobuf field string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * An optional human-readable description of this notification channel. This + * description may provide additional details, beyond the display + * name, for the channel. This may not exceed 1024 Unicode characters. + * + * Generated from protobuf field string description = 4; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * An optional human-readable description of this notification channel. This + * description may provide additional details, beyond the display + * name, for the channel. This may not exceed 1024 Unicode characters. + * + * Generated from protobuf field string description = 4; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Configuration fields that define the channel and its behavior. The + * permissible and required labels are specified in the + * [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] + * of the `NotificationChannelDescriptor` corresponding to the `type` field. + * + * Generated from protobuf field map labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Configuration fields that define the channel and its behavior. The + * permissible and required labels are specified in the + * [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] + * of the `NotificationChannelDescriptor` corresponding to the `type` field. + * + * Generated from protobuf field map labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * User-supplied key/value data that does not need to conform to + * the corresponding `NotificationChannelDescriptor`'s schema, unlike + * the `labels` field. This field is intended to be used for organizing + * and identifying the `NotificationChannel` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * User-supplied key/value data that does not need to conform to + * the corresponding `NotificationChannelDescriptor`'s schema, unlike + * the `labels` field. This field is intended to be used for organizing + * and identifying the `NotificationChannel` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + + /** + * Indicates whether this channel has been verified or not. On a + * [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * or + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation, this field is expected to be populated. + * If the value is `UNVERIFIED`, then it indicates that the channel is + * non-functioning (it both requires verification and lacks verification); + * otherwise, it is assumed that the channel works. + * If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that + * the channel is of a type that does not require verification or that + * this specific channel has been exempted from verification because it was + * created prior to verification being required for channels of this type. + * This field cannot be modified using a standard + * [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + * operation. To change the value of this field, you must call + * [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel.VerificationStatus verification_status = 9; + * @return int + */ + public function getVerificationStatus() + { + return $this->verification_status; + } + + /** + * Indicates whether this channel has been verified or not. On a + * [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + * or + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation, this field is expected to be populated. + * If the value is `UNVERIFIED`, then it indicates that the channel is + * non-functioning (it both requires verification and lacks verification); + * otherwise, it is assumed that the channel works. + * If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that + * the channel is of a type that does not require verification or that + * this specific channel has been exempted from verification because it was + * created prior to verification being required for channels of this type. + * This field cannot be modified using a standard + * [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + * operation. To change the value of this field, you must call + * [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel.VerificationStatus verification_status = 9; + * @param int $var + * @return $this + */ + public function setVerificationStatus($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\NotificationChannel\VerificationStatus::class); + $this->verification_status = $var; + + return $this; + } + + /** + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 11; + * @return \Google\Protobuf\BoolValue|null + */ + public function getEnabled() + { + return $this->enabled; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Returns the unboxed value from getEnabled() + + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 11; + * @return bool|null + */ + public function getEnabledUnwrapped() + { + return $this->readWrapperValue("enabled"); + } + + /** + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 11; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->enabled = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object. + + * Whether notifications are forwarded to the described channel. This makes + * it possible to disable delivery of notifications to a particular channel + * without removing the channel from all alerting policies that reference + * the channel. This is a more convenient approach when the change is + * temporary and you want to receive notifications from the same set + * of alerting policies on the channel at some point in the future. + * + * Generated from protobuf field .google.protobuf.BoolValue enabled = 11; + * @param bool|null $var + * @return $this + */ + public function setEnabledUnwrapped($var) + { + $this->writeWrapperValue("enabled", $var); + return $this;} + + /** + * Record of the creation of this channel. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 12; + * @return \Google\Cloud\Monitoring\V3\MutationRecord|null + */ + public function getCreationRecord() + { + return $this->creation_record; + } + + public function hasCreationRecord() + { + return isset($this->creation_record); + } + + public function clearCreationRecord() + { + unset($this->creation_record); + } + + /** + * Record of the creation of this channel. + * + * Generated from protobuf field .google.monitoring.v3.MutationRecord creation_record = 12; + * @param \Google\Cloud\Monitoring\V3\MutationRecord $var + * @return $this + */ + public function setCreationRecord($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class); + $this->creation_record = $var; + + return $this; + } + + /** + * Records of the modification of this channel. + * + * Generated from protobuf field repeated .google.monitoring.v3.MutationRecord mutation_records = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMutationRecords() + { + return $this->mutation_records; + } + + /** + * Records of the modification of this channel. + * + * Generated from protobuf field repeated .google.monitoring.v3.MutationRecord mutation_records = 13; + * @param array<\Google\Cloud\Monitoring\V3\MutationRecord>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMutationRecords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\MutationRecord::class); + $this->mutation_records = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel/VerificationStatus.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel/VerificationStatus.php new file mode 100644 index 000000000000..2b70fa842873 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannel/VerificationStatus.php @@ -0,0 +1,76 @@ +google.monitoring.v3.NotificationChannel.VerificationStatus + */ +class VerificationStatus +{ + /** + * Sentinel value used to indicate that the state is unknown, omitted, or + * is not applicable (as in the case of channels that neither support + * nor require verification in order to function). + * + * Generated from protobuf enum VERIFICATION_STATUS_UNSPECIFIED = 0; + */ + const VERIFICATION_STATUS_UNSPECIFIED = 0; + /** + * The channel has yet to be verified and requires verification to function. + * Note that this state also applies to the case where the verification + * process has been initiated by sending a verification code but where + * the verification code has not been submitted to complete the process. + * + * Generated from protobuf enum UNVERIFIED = 1; + */ + const UNVERIFIED = 1; + /** + * It has been proven that notifications can be received on this + * notification channel and that someone on the project has access + * to messages that are delivered to that channel. + * + * Generated from protobuf enum VERIFIED = 2; + */ + const VERIFIED = 2; + + private static $valueToName = [ + self::VERIFICATION_STATUS_UNSPECIFIED => 'VERIFICATION_STATUS_UNSPECIFIED', + self::UNVERIFIED => 'UNVERIFIED', + self::VERIFIED => 'VERIFIED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VerificationStatus::class, \Google\Cloud\Monitoring\V3\NotificationChannel_VerificationStatus::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannelDescriptor.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannelDescriptor.php new file mode 100644 index 000000000000..f9e6c8c27145 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/NotificationChannelDescriptor.php @@ -0,0 +1,326 @@ +google.monitoring.v3.NotificationChannelDescriptor + */ +class NotificationChannelDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The full REST resource name for this descriptor. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE] + * In the above, `[TYPE]` is the value of the `type` field. + * + * Generated from protobuf field string name = 6; + */ + protected $name = ''; + /** + * The type of notification channel, such as "email" and "sms". To view the + * full list of channels, see + * [Channel + * descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd). + * Notification channel types are globally unique. + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * A human-readable name for the notification channel type. This + * form of the name is suitable for a user interface. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * A human-readable description of the notification channel + * type. The description may include a description of the properties + * of the channel and pointers to external documentation. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * The set of labels that must be defined to identify a particular + * channel of the corresponding type. Each label includes a + * description for how that field should be populated. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + */ + private $labels; + /** + * The tiers that support this notification channel; the project service tier + * must be one of the supported_tiers. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceTier supported_tiers = 5 [deprecated = true]; + * @deprecated + */ + private $supported_tiers; + /** + * The product launch stage for channels of this type. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 7; + */ + protected $launch_stage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The full REST resource name for this descriptor. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE] + * In the above, `[TYPE]` is the value of the `type` field. + * @type string $type + * The type of notification channel, such as "email" and "sms". To view the + * full list of channels, see + * [Channel + * descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd). + * Notification channel types are globally unique. + * @type string $display_name + * A human-readable name for the notification channel type. This + * form of the name is suitable for a user interface. + * @type string $description + * A human-readable description of the notification channel + * type. The description may include a description of the properties + * of the channel and pointers to external documentation. + * @type array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $labels + * The set of labels that must be defined to identify a particular + * channel of the corresponding type. Each label includes a + * description for how that field should be populated. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_tiers + * The tiers that support this notification channel; the project service tier + * must be one of the supported_tiers. + * @type int $launch_stage + * The product launch stage for channels of this type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Notification::initOnce(); + parent::__construct($data); + } + + /** + * The full REST resource name for this descriptor. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE] + * In the above, `[TYPE]` is the value of the `type` field. + * + * Generated from protobuf field string name = 6; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The full REST resource name for this descriptor. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE] + * In the above, `[TYPE]` is the value of the `type` field. + * + * Generated from protobuf field string name = 6; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of notification channel, such as "email" and "sms". To view the + * full list of channels, see + * [Channel + * descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd). + * Notification channel types are globally unique. + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type of notification channel, such as "email" and "sms". To view the + * full list of channels, see + * [Channel + * descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd). + * Notification channel types are globally unique. + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * A human-readable name for the notification channel type. This + * form of the name is suitable for a user interface. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A human-readable name for the notification channel type. This + * form of the name is suitable for a user interface. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * A human-readable description of the notification channel + * type. The description may include a description of the properties + * of the channel and pointers to external documentation. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A human-readable description of the notification channel + * type. The description may include a description of the properties + * of the channel and pointers to external documentation. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The set of labels that must be defined to identify a particular + * channel of the corresponding type. Each label includes a + * description for how that field should be populated. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The set of labels that must be defined to identify a particular + * channel of the corresponding type. Each label includes a + * description for how that field should be populated. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; + * @param array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); + $this->labels = $arr; + + return $this; + } + + /** + * The tiers that support this notification channel; the project service tier + * must be one of the supported_tiers. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceTier supported_tiers = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getSupportedTiers() + { + @trigger_error('supported_tiers is deprecated.', E_USER_DEPRECATED); + return $this->supported_tiers; + } + + /** + * The tiers that support this notification channel; the project service tier + * must be one of the supported_tiers. + * + * Generated from protobuf field repeated .google.monitoring.v3.ServiceTier supported_tiers = 5 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setSupportedTiers($var) + { + @trigger_error('supported_tiers is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Monitoring\V3\ServiceTier::class); + $this->supported_tiers = $arr; + + return $this; + } + + /** + * The product launch stage for channels of this type. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 7; + * @return int + */ + public function getLaunchStage() + { + return $this->launch_stage; + } + + /** + * The product launch stage for channels of this type. + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 7; + * @param int $var + * @return $this + */ + public function setLaunchStage($var) + { + GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class); + $this->launch_stage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Point.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Point.php new file mode 100644 index 000000000000..5db4ed6c5b78 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Point.php @@ -0,0 +1,153 @@ +google.monitoring.v3.Point + */ +class Point extends \Google\Protobuf\Internal\Message +{ + /** + * The time interval to which the data point applies. For `GAUGE` metrics, + * the start time is optional, but if it is supplied, it must equal the + * end time. For `DELTA` metrics, the start + * and end time should specify a non-zero interval, with subsequent points + * specifying contiguous and non-overlapping intervals. For `CUMULATIVE` + * metrics, the start and end time should specify a non-zero interval, with + * subsequent points specifying the same start time and increasing end times, + * until an event resets the cumulative value to zero and sets a new start + * time for the following points. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 1; + */ + protected $interval = null; + /** + * The value of the data point. + * + * Generated from protobuf field .google.monitoring.v3.TypedValue value = 2; + */ + protected $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\TimeInterval $interval + * The time interval to which the data point applies. For `GAUGE` metrics, + * the start time is optional, but if it is supplied, it must equal the + * end time. For `DELTA` metrics, the start + * and end time should specify a non-zero interval, with subsequent points + * specifying contiguous and non-overlapping intervals. For `CUMULATIVE` + * metrics, the start and end time should specify a non-zero interval, with + * subsequent points specifying the same start time and increasing end times, + * until an event resets the cumulative value to zero and sets a new start + * time for the following points. + * @type \Google\Cloud\Monitoring\V3\TypedValue $value + * The value of the data point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The time interval to which the data point applies. For `GAUGE` metrics, + * the start time is optional, but if it is supplied, it must equal the + * end time. For `DELTA` metrics, the start + * and end time should specify a non-zero interval, with subsequent points + * specifying contiguous and non-overlapping intervals. For `CUMULATIVE` + * metrics, the start and end time should specify a non-zero interval, with + * subsequent points specifying the same start time and increasing end times, + * until an event resets the cumulative value to zero and sets a new start + * time for the following points. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 1; + * @return \Google\Cloud\Monitoring\V3\TimeInterval|null + */ + public function getInterval() + { + return $this->interval; + } + + public function hasInterval() + { + return isset($this->interval); + } + + public function clearInterval() + { + unset($this->interval); + } + + /** + * The time interval to which the data point applies. For `GAUGE` metrics, + * the start time is optional, but if it is supplied, it must equal the + * end time. For `DELTA` metrics, the start + * and end time should specify a non-zero interval, with subsequent points + * specifying contiguous and non-overlapping intervals. For `CUMULATIVE` + * metrics, the start and end time should specify a non-zero interval, with + * subsequent points specifying the same start time and increasing end times, + * until an event resets the cumulative value to zero and sets a new start + * time for the following points. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 1; + * @param \Google\Cloud\Monitoring\V3\TimeInterval $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeInterval::class); + $this->interval = $var; + + return $this; + } + + /** + * The value of the data point. + * + * Generated from protobuf field .google.monitoring.v3.TypedValue value = 2; + * @return \Google\Cloud\Monitoring\V3\TypedValue|null + */ + public function getValue() + { + return $this->value; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * The value of the data point. + * + * Generated from protobuf field .google.monitoring.v3.TypedValue value = 2; + * @param \Google\Cloud\Monitoring\V3\TypedValue $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TypedValue::class); + $this->value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryError.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryError.php new file mode 100644 index 000000000000..8ff8ad79a2a5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryError.php @@ -0,0 +1,115 @@ +google.monitoring.v3.QueryError + */ +class QueryError extends \Google\Protobuf\Internal\Message +{ + /** + * The location of the time series query language text that this error applies + * to. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator locator = 1; + */ + protected $locator = null; + /** + * The error message. + * + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\TextLocator $locator + * The location of the time series query language text that this error applies + * to. + * @type string $message + * The error message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The location of the time series query language text that this error applies + * to. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator locator = 1; + * @return \Google\Cloud\Monitoring\V3\TextLocator|null + */ + public function getLocator() + { + return $this->locator; + } + + public function hasLocator() + { + return isset($this->locator); + } + + public function clearLocator() + { + unset($this->locator); + } + + /** + * The location of the time series query language text that this error applies + * to. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator locator = 1; + * @param \Google\Cloud\Monitoring\V3\TextLocator $var + * @return $this + */ + public function setLocator($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TextLocator::class); + $this->locator = $var; + + return $this; + } + + /** + * The error message. + * + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * The error message. + * + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryErrorList.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryErrorList.php new file mode 100644 index 000000000000..95542afd49b9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryErrorList.php @@ -0,0 +1,105 @@ +google.monitoring.v3.QueryErrorList + */ +class QueryErrorList extends \Google\Protobuf\Internal\Message +{ + /** + * Errors in parsing the time series query language text. The number of errors + * in the response may be limited. + * + * Generated from protobuf field repeated .google.monitoring.v3.QueryError errors = 1; + */ + private $errors; + /** + * A summary of all the errors. + * + * Generated from protobuf field string error_summary = 2; + */ + protected $error_summary = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\QueryError>|\Google\Protobuf\Internal\RepeatedField $errors + * Errors in parsing the time series query language text. The number of errors + * in the response may be limited. + * @type string $error_summary + * A summary of all the errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Errors in parsing the time series query language text. The number of errors + * in the response may be limited. + * + * Generated from protobuf field repeated .google.monitoring.v3.QueryError errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Errors in parsing the time series query language text. The number of errors + * in the response may be limited. + * + * Generated from protobuf field repeated .google.monitoring.v3.QueryError errors = 1; + * @param array<\Google\Cloud\Monitoring\V3\QueryError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\QueryError::class); + $this->errors = $arr; + + return $this; + } + + /** + * A summary of all the errors. + * + * Generated from protobuf field string error_summary = 2; + * @return string + */ + public function getErrorSummary() + { + return $this->error_summary; + } + + /** + * A summary of all the errors. + * + * Generated from protobuf field string error_summary = 2; + * @param string $var + * @return $this + */ + public function setErrorSummary($var) + { + GPBUtil::checkString($var, True); + $this->error_summary = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesRequest.php new file mode 100644 index 000000000000..2c29945f9c37 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesRequest.php @@ -0,0 +1,200 @@ +google.monitoring.v3.QueryTimeSeriesRequest + */ +class QueryTimeSeriesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * + * Generated from protobuf field string query = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + /** + * A positive number that is the maximum number of time_series_data to return. + * + * Generated from protobuf field int32 page_size = 9; + */ + protected $page_size = 0; + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 10; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * @type string $query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @type int $page_size + * A positive number that is the maximum number of time_series_data to return. + * @type string $page_token + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * projects/[PROJECT_ID_OR_NUMBER] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * + * Generated from protobuf field string query = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * + * Generated from protobuf field string query = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * A positive number that is the maximum number of time_series_data to return. + * + * Generated from protobuf field int32 page_size = 9; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * A positive number that is the maximum number of time_series_data to return. + * + * Generated from protobuf field int32 page_size = 9; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 10; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * + * Generated from protobuf field string page_token = 10; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesResponse.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesResponse.php new file mode 100644 index 000000000000..fadd0f03899f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/QueryTimeSeriesResponse.php @@ -0,0 +1,198 @@ +google.monitoring.v3.QueryTimeSeriesResponse + */ +class QueryTimeSeriesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The descriptor for the time series data. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeriesDescriptor time_series_descriptor = 8; + */ + protected $time_series_descriptor = null; + /** + * The time series data. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData time_series_data = 9; + */ + private $time_series_data; + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 10; + */ + protected $next_page_token = ''; + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. The available data will be available in the + * response. + * + * Generated from protobuf field repeated .google.rpc.Status partial_errors = 11; + */ + private $partial_errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor $time_series_descriptor + * The descriptor for the time series data. + * @type array<\Google\Cloud\Monitoring\V3\TimeSeriesData>|\Google\Protobuf\Internal\RepeatedField $time_series_data + * The time series data. + * @type string $next_page_token + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $partial_errors + * Query execution errors that may have caused the time series data returned + * to be incomplete. The available data will be available in the + * response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\MetricService::initOnce(); + parent::__construct($data); + } + + /** + * The descriptor for the time series data. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeriesDescriptor time_series_descriptor = 8; + * @return \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor|null + */ + public function getTimeSeriesDescriptor() + { + return $this->time_series_descriptor; + } + + public function hasTimeSeriesDescriptor() + { + return isset($this->time_series_descriptor); + } + + public function clearTimeSeriesDescriptor() + { + unset($this->time_series_descriptor); + } + + /** + * The descriptor for the time series data. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeriesDescriptor time_series_descriptor = 8; + * @param \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor $var + * @return $this + */ + public function setTimeSeriesDescriptor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor::class); + $this->time_series_descriptor = $var; + + return $this; + } + + /** + * The time series data. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData time_series_data = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeSeriesData() + { + return $this->time_series_data; + } + + /** + * The time series data. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData time_series_data = 9; + * @param array<\Google\Cloud\Monitoring\V3\TimeSeriesData>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeSeriesData($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeriesData::class); + $this->time_series_data = $arr; + + return $this; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 10; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * If there are more results than have been returned, then this field is set + * to a non-empty value. To see the additional results, use that value as + * `page_token` in the next call to this method. + * + * Generated from protobuf field string next_page_token = 10; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. The available data will be available in the + * response. + * + * Generated from protobuf field repeated .google.rpc.Status partial_errors = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartialErrors() + { + return $this->partial_errors; + } + + /** + * Query execution errors that may have caused the time series data returned + * to be incomplete. The available data will be available in the + * response. + * + * Generated from protobuf field repeated .google.rpc.Status partial_errors = 11; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartialErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->partial_errors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Range.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Range.php new file mode 100644 index 000000000000..3dd0db9c39f2 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Range.php @@ -0,0 +1,101 @@ +google.monitoring.v3.Range + */ +class Range extends \Google\Protobuf\Internal\Message +{ + /** + * Range minimum. + * + * Generated from protobuf field double min = 1; + */ + protected $min = 0.0; + /** + * Range maximum. + * + * Generated from protobuf field double max = 2; + */ + protected $max = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $min + * Range minimum. + * @type float $max + * Range maximum. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Range minimum. + * + * Generated from protobuf field double min = 1; + * @return float + */ + public function getMin() + { + return $this->min; + } + + /** + * Range minimum. + * + * Generated from protobuf field double min = 1; + * @param float $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkDouble($var); + $this->min = $var; + + return $this; + } + + /** + * Range maximum. + * + * Generated from protobuf field double max = 2; + * @return float + */ + public function getMax() + { + return $this->max; + } + + /** + * Range maximum. + * + * Generated from protobuf field double max = 2; + * @param float $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkDouble($var); + $this->max = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/RequestBasedSli.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/RequestBasedSli.php new file mode 100644 index 000000000000..e4820f273c21 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/RequestBasedSli.php @@ -0,0 +1,121 @@ +google.monitoring.v3.RequestBasedSli + */ +class RequestBasedSli extends \Google\Protobuf\Internal\Message +{ + protected $method; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\TimeSeriesRatio $good_total_ratio + * `good_total_ratio` is used when the ratio of `good_service` to + * `total_service` is computed from two `TimeSeries`. + * @type \Google\Cloud\Monitoring\V3\DistributionCut $distribution_cut + * `distribution_cut` is used when `good_service` is a count of values + * aggregated in a `Distribution` that fall into a good range. The + * `total_service` is the total count of all values aggregated in the + * `Distribution`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * `good_total_ratio` is used when the ratio of `good_service` to + * `total_service` is computed from two `TimeSeries`. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeriesRatio good_total_ratio = 1; + * @return \Google\Cloud\Monitoring\V3\TimeSeriesRatio|null + */ + public function getGoodTotalRatio() + { + return $this->readOneof(1); + } + + public function hasGoodTotalRatio() + { + return $this->hasOneof(1); + } + + /** + * `good_total_ratio` is used when the ratio of `good_service` to + * `total_service` is computed from two `TimeSeries`. + * + * Generated from protobuf field .google.monitoring.v3.TimeSeriesRatio good_total_ratio = 1; + * @param \Google\Cloud\Monitoring\V3\TimeSeriesRatio $var + * @return $this + */ + public function setGoodTotalRatio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeSeriesRatio::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * `distribution_cut` is used when `good_service` is a count of values + * aggregated in a `Distribution` that fall into a good range. The + * `total_service` is the total count of all values aggregated in the + * `Distribution`. + * + * Generated from protobuf field .google.monitoring.v3.DistributionCut distribution_cut = 3; + * @return \Google\Cloud\Monitoring\V3\DistributionCut|null + */ + public function getDistributionCut() + { + return $this->readOneof(3); + } + + public function hasDistributionCut() + { + return $this->hasOneof(3); + } + + /** + * `distribution_cut` is used when `good_service` is a count of values + * aggregated in a `Distribution` that fall into a good range. The + * `total_service` is the total count of all values aggregated in the + * `Distribution`. + * + * Generated from protobuf field .google.monitoring.v3.DistributionCut distribution_cut = 3; + * @param \Google\Cloud\Monitoring\V3\DistributionCut $var + * @return $this + */ + public function setDistributionCut($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\DistributionCut::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getMethod() + { + return $this->whichOneof("method"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SendNotificationChannelVerificationCodeRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SendNotificationChannelVerificationCodeRequest.php new file mode 100644 index 000000000000..efa0e97e35bc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SendNotificationChannelVerificationCodeRequest.php @@ -0,0 +1,81 @@ +google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + */ +class SendNotificationChannelVerificationCodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The notification channel to which to send a verification code. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The notification channel to which to send a verification code. Please see + * {@see NotificationChannelServiceClient::notificationChannelName()} for help formatting this field. + * + * @return \Google\Cloud\Monitoring\V3\SendNotificationChannelVerificationCodeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The notification channel to which to send a verification code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The notification channel to which to send a verification code. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The notification channel to which to send a verification code. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service.php new file mode 100644 index 000000000000..8b8aa5f3c2fe --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service.php @@ -0,0 +1,608 @@ +google.monitoring.v3.Service + */ +class Service extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Resource name for this Service. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Name used for UI elements listing this Service. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Message that contains the service type and service labels of this service + * if it is a basic service. + * Documentation and examples + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field .google.monitoring.v3.Service.BasicService basic_service = 19; + */ + protected $basic_service = null; + /** + * Configuration for how to query telemetry on a Service. + * + * Generated from protobuf field .google.monitoring.v3.Service.Telemetry telemetry = 13; + */ + protected $telemetry = null; + /** + * Labels which have been used to annotate the service. Label keys must start + * with a letter. Label keys and values may contain lowercase letters, + * numbers, underscores, and dashes. Label keys and values have a maximum + * length of 63 characters, and must be less than 128 bytes in size. Up to 64 + * label entries may be stored. For labels which do not have a semantic value, + * the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 14; + */ + private $user_labels; + protected $identifier; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. Resource name for this Service. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @type string $display_name + * Name used for UI elements listing this Service. + * @type \Google\Cloud\Monitoring\V3\Service\Custom $custom + * Custom service type. + * @type \Google\Cloud\Monitoring\V3\Service\AppEngine $app_engine + * Type used for App Engine services. + * @type \Google\Cloud\Monitoring\V3\Service\CloudEndpoints $cloud_endpoints + * Type used for Cloud Endpoints services. + * @type \Google\Cloud\Monitoring\V3\Service\ClusterIstio $cluster_istio + * Type used for Istio services that live in a Kubernetes cluster. + * @type \Google\Cloud\Monitoring\V3\Service\MeshIstio $mesh_istio + * Type used for Istio services scoped to an Istio mesh. + * @type \Google\Cloud\Monitoring\V3\Service\IstioCanonicalService $istio_canonical_service + * Type used for canonical services scoped to an Istio mesh. + * Metrics for Istio are + * [documented here](https://istio.io/latest/docs/reference/config/metrics/) + * @type \Google\Cloud\Monitoring\V3\Service\CloudRun $cloud_run + * Type used for Cloud Run services. + * @type \Google\Cloud\Monitoring\V3\Service\GkeNamespace $gke_namespace + * Type used for GKE Namespaces. + * @type \Google\Cloud\Monitoring\V3\Service\GkeWorkload $gke_workload + * Type used for GKE Workloads. + * @type \Google\Cloud\Monitoring\V3\Service\GkeService $gke_service + * Type used for GKE Services (the Kubernetes concept of a service). + * @type \Google\Cloud\Monitoring\V3\Service\BasicService $basic_service + * Message that contains the service type and service labels of this service + * if it is a basic service. + * Documentation and examples + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * @type \Google\Cloud\Monitoring\V3\Service\Telemetry $telemetry + * Configuration for how to query telemetry on a Service. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * Labels which have been used to annotate the service. Label keys must start + * with a letter. Label keys and values may contain lowercase letters, + * numbers, underscores, and dashes. Label keys and values have a maximum + * length of 63 characters, and must be less than 128 bytes in size. Up to 64 + * label entries may be stored. For labels which do not have a semantic value, + * the empty string may be supplied for the label value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. Resource name for this Service. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Resource name for this Service. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Name used for UI elements listing this Service. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Name used for UI elements listing this Service. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Custom service type. + * + * Generated from protobuf field .google.monitoring.v3.Service.Custom custom = 6; + * @return \Google\Cloud\Monitoring\V3\Service\Custom|null + */ + public function getCustom() + { + return $this->readOneof(6); + } + + public function hasCustom() + { + return $this->hasOneof(6); + } + + /** + * Custom service type. + * + * Generated from protobuf field .google.monitoring.v3.Service.Custom custom = 6; + * @param \Google\Cloud\Monitoring\V3\Service\Custom $var + * @return $this + */ + public function setCustom($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\Custom::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Type used for App Engine services. + * + * Generated from protobuf field .google.monitoring.v3.Service.AppEngine app_engine = 7; + * @return \Google\Cloud\Monitoring\V3\Service\AppEngine|null + */ + public function getAppEngine() + { + return $this->readOneof(7); + } + + public function hasAppEngine() + { + return $this->hasOneof(7); + } + + /** + * Type used for App Engine services. + * + * Generated from protobuf field .google.monitoring.v3.Service.AppEngine app_engine = 7; + * @param \Google\Cloud\Monitoring\V3\Service\AppEngine $var + * @return $this + */ + public function setAppEngine($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\AppEngine::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Type used for Cloud Endpoints services. + * + * Generated from protobuf field .google.monitoring.v3.Service.CloudEndpoints cloud_endpoints = 8; + * @return \Google\Cloud\Monitoring\V3\Service\CloudEndpoints|null + */ + public function getCloudEndpoints() + { + return $this->readOneof(8); + } + + public function hasCloudEndpoints() + { + return $this->hasOneof(8); + } + + /** + * Type used for Cloud Endpoints services. + * + * Generated from protobuf field .google.monitoring.v3.Service.CloudEndpoints cloud_endpoints = 8; + * @param \Google\Cloud\Monitoring\V3\Service\CloudEndpoints $var + * @return $this + */ + public function setCloudEndpoints($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\CloudEndpoints::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Type used for Istio services that live in a Kubernetes cluster. + * + * Generated from protobuf field .google.monitoring.v3.Service.ClusterIstio cluster_istio = 9; + * @return \Google\Cloud\Monitoring\V3\Service\ClusterIstio|null + */ + public function getClusterIstio() + { + return $this->readOneof(9); + } + + public function hasClusterIstio() + { + return $this->hasOneof(9); + } + + /** + * Type used for Istio services that live in a Kubernetes cluster. + * + * Generated from protobuf field .google.monitoring.v3.Service.ClusterIstio cluster_istio = 9; + * @param \Google\Cloud\Monitoring\V3\Service\ClusterIstio $var + * @return $this + */ + public function setClusterIstio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\ClusterIstio::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Type used for Istio services scoped to an Istio mesh. + * + * Generated from protobuf field .google.monitoring.v3.Service.MeshIstio mesh_istio = 10; + * @return \Google\Cloud\Monitoring\V3\Service\MeshIstio|null + */ + public function getMeshIstio() + { + return $this->readOneof(10); + } + + public function hasMeshIstio() + { + return $this->hasOneof(10); + } + + /** + * Type used for Istio services scoped to an Istio mesh. + * + * Generated from protobuf field .google.monitoring.v3.Service.MeshIstio mesh_istio = 10; + * @param \Google\Cloud\Monitoring\V3\Service\MeshIstio $var + * @return $this + */ + public function setMeshIstio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\MeshIstio::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Type used for canonical services scoped to an Istio mesh. + * Metrics for Istio are + * [documented here](https://istio.io/latest/docs/reference/config/metrics/) + * + * Generated from protobuf field .google.monitoring.v3.Service.IstioCanonicalService istio_canonical_service = 11; + * @return \Google\Cloud\Monitoring\V3\Service\IstioCanonicalService|null + */ + public function getIstioCanonicalService() + { + return $this->readOneof(11); + } + + public function hasIstioCanonicalService() + { + return $this->hasOneof(11); + } + + /** + * Type used for canonical services scoped to an Istio mesh. + * Metrics for Istio are + * [documented here](https://istio.io/latest/docs/reference/config/metrics/) + * + * Generated from protobuf field .google.monitoring.v3.Service.IstioCanonicalService istio_canonical_service = 11; + * @param \Google\Cloud\Monitoring\V3\Service\IstioCanonicalService $var + * @return $this + */ + public function setIstioCanonicalService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\IstioCanonicalService::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Type used for Cloud Run services. + * + * Generated from protobuf field .google.monitoring.v3.Service.CloudRun cloud_run = 12; + * @return \Google\Cloud\Monitoring\V3\Service\CloudRun|null + */ + public function getCloudRun() + { + return $this->readOneof(12); + } + + public function hasCloudRun() + { + return $this->hasOneof(12); + } + + /** + * Type used for Cloud Run services. + * + * Generated from protobuf field .google.monitoring.v3.Service.CloudRun cloud_run = 12; + * @param \Google\Cloud\Monitoring\V3\Service\CloudRun $var + * @return $this + */ + public function setCloudRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\CloudRun::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Type used for GKE Namespaces. + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeNamespace gke_namespace = 15; + * @return \Google\Cloud\Monitoring\V3\Service\GkeNamespace|null + */ + public function getGkeNamespace() + { + return $this->readOneof(15); + } + + public function hasGkeNamespace() + { + return $this->hasOneof(15); + } + + /** + * Type used for GKE Namespaces. + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeNamespace gke_namespace = 15; + * @param \Google\Cloud\Monitoring\V3\Service\GkeNamespace $var + * @return $this + */ + public function setGkeNamespace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\GkeNamespace::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Type used for GKE Workloads. + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeWorkload gke_workload = 16; + * @return \Google\Cloud\Monitoring\V3\Service\GkeWorkload|null + */ + public function getGkeWorkload() + { + return $this->readOneof(16); + } + + public function hasGkeWorkload() + { + return $this->hasOneof(16); + } + + /** + * Type used for GKE Workloads. + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeWorkload gke_workload = 16; + * @param \Google\Cloud\Monitoring\V3\Service\GkeWorkload $var + * @return $this + */ + public function setGkeWorkload($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\GkeWorkload::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Type used for GKE Services (the Kubernetes concept of a service). + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeService gke_service = 17; + * @return \Google\Cloud\Monitoring\V3\Service\GkeService|null + */ + public function getGkeService() + { + return $this->readOneof(17); + } + + public function hasGkeService() + { + return $this->hasOneof(17); + } + + /** + * Type used for GKE Services (the Kubernetes concept of a service). + * + * Generated from protobuf field .google.monitoring.v3.Service.GkeService gke_service = 17; + * @param \Google\Cloud\Monitoring\V3\Service\GkeService $var + * @return $this + */ + public function setGkeService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\GkeService::class); + $this->writeOneof(17, $var); + + return $this; + } + + /** + * Message that contains the service type and service labels of this service + * if it is a basic service. + * Documentation and examples + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field .google.monitoring.v3.Service.BasicService basic_service = 19; + * @return \Google\Cloud\Monitoring\V3\Service\BasicService|null + */ + public function getBasicService() + { + return $this->basic_service; + } + + public function hasBasicService() + { + return isset($this->basic_service); + } + + public function clearBasicService() + { + unset($this->basic_service); + } + + /** + * Message that contains the service type and service labels of this service + * if it is a basic service. + * Documentation and examples + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field .google.monitoring.v3.Service.BasicService basic_service = 19; + * @param \Google\Cloud\Monitoring\V3\Service\BasicService $var + * @return $this + */ + public function setBasicService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\BasicService::class); + $this->basic_service = $var; + + return $this; + } + + /** + * Configuration for how to query telemetry on a Service. + * + * Generated from protobuf field .google.monitoring.v3.Service.Telemetry telemetry = 13; + * @return \Google\Cloud\Monitoring\V3\Service\Telemetry|null + */ + public function getTelemetry() + { + return $this->telemetry; + } + + public function hasTelemetry() + { + return isset($this->telemetry); + } + + public function clearTelemetry() + { + unset($this->telemetry); + } + + /** + * Configuration for how to query telemetry on a Service. + * + * Generated from protobuf field .google.monitoring.v3.Service.Telemetry telemetry = 13; + * @param \Google\Cloud\Monitoring\V3\Service\Telemetry $var + * @return $this + */ + public function setTelemetry($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service\Telemetry::class); + $this->telemetry = $var; + + return $this; + } + + /** + * Labels which have been used to annotate the service. Label keys must start + * with a letter. Label keys and values may contain lowercase letters, + * numbers, underscores, and dashes. Label keys and values have a maximum + * length of 63 characters, and must be less than 128 bytes in size. Up to 64 + * label entries may be stored. For labels which do not have a semantic value, + * the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 14; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * Labels which have been used to annotate the service. Label keys must start + * with a letter. Label keys and values may contain lowercase letters, + * numbers, underscores, and dashes. Label keys and values have a maximum + * length of 63 characters, and must be less than 128 bytes in size. Up to 64 + * label entries may be stored. For labels which do not have a semantic value, + * the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 14; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getIdentifier() + { + return $this->whichOneof("identifier"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/AppEngine.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/AppEngine.php new file mode 100644 index 000000000000..7dd90e27a87e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/AppEngine.php @@ -0,0 +1,78 @@ +google.monitoring.v3.Service.AppEngine + */ +class AppEngine extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the App Engine module underlying this service. Corresponds to + * the `module_id` resource label in the [`gae_app` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app). + * + * Generated from protobuf field string module_id = 1; + */ + protected $module_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $module_id + * The ID of the App Engine module underlying this service. Corresponds to + * the `module_id` resource label in the [`gae_app` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The ID of the App Engine module underlying this service. Corresponds to + * the `module_id` resource label in the [`gae_app` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app). + * + * Generated from protobuf field string module_id = 1; + * @return string + */ + public function getModuleId() + { + return $this->module_id; + } + + /** + * The ID of the App Engine module underlying this service. Corresponds to + * the `module_id` resource label in the [`gae_app` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app). + * + * Generated from protobuf field string module_id = 1; + * @param string $var + * @return $this + */ + public function setModuleId($var) + { + GPBUtil::checkString($var, True); + $this->module_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AppEngine::class, \Google\Cloud\Monitoring\V3\Service_AppEngine::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/BasicService.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/BasicService.php new file mode 100644 index 000000000000..5efe00c1cda5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/BasicService.php @@ -0,0 +1,130 @@ +google.monitoring.v3.Service.BasicService + */ +class BasicService extends \Google\Protobuf\Internal\Message +{ + /** + * The type of service that this basic service defines, e.g. + * APP_ENGINE service type. + * Documentation and valid values + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field string service_type = 1; + */ + protected $service_type = ''; + /** + * Labels that specify the resource that emits the monitoring data which + * is used for SLO reporting of this `Service`. + * Documentation and valid values for given service types + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field map service_labels = 2; + */ + private $service_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_type + * The type of service that this basic service defines, e.g. + * APP_ENGINE service type. + * Documentation and valid values + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * @type array|\Google\Protobuf\Internal\MapField $service_labels + * Labels that specify the resource that emits the monitoring data which + * is used for SLO reporting of this `Service`. + * Documentation and valid values for given service types + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The type of service that this basic service defines, e.g. + * APP_ENGINE service type. + * Documentation and valid values + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field string service_type = 1; + * @return string + */ + public function getServiceType() + { + return $this->service_type; + } + + /** + * The type of service that this basic service defines, e.g. + * APP_ENGINE service type. + * Documentation and valid values + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field string service_type = 1; + * @param string $var + * @return $this + */ + public function setServiceType($var) + { + GPBUtil::checkString($var, True); + $this->service_type = $var; + + return $this; + } + + /** + * Labels that specify the resource that emits the monitoring data which + * is used for SLO reporting of this `Service`. + * Documentation and valid values for given service types + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field map service_labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getServiceLabels() + { + return $this->service_labels; + } + + /** + * Labels that specify the resource that emits the monitoring data which + * is used for SLO reporting of this `Service`. + * Documentation and valid values for given service types + * [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli). + * + * Generated from protobuf field map service_labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setServiceLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->service_labels = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BasicService::class, \Google\Cloud\Monitoring\V3\Service_BasicService::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudEndpoints.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudEndpoints.php new file mode 100644 index 000000000000..6560ccb0626d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudEndpoints.php @@ -0,0 +1,78 @@ +google.monitoring.v3.Service.CloudEndpoints + */ +class CloudEndpoints extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the Cloud Endpoints service underlying this service. + * Corresponds to the `service` resource label in the [`api` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_api). + * + * Generated from protobuf field string service = 1; + */ + protected $service = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * The name of the Cloud Endpoints service underlying this service. + * Corresponds to the `service` resource label in the [`api` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_api). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The name of the Cloud Endpoints service underlying this service. + * Corresponds to the `service` resource label in the [`api` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_api). + * + * Generated from protobuf field string service = 1; + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * The name of the Cloud Endpoints service underlying this service. + * Corresponds to the `service` resource label in the [`api` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_api). + * + * Generated from protobuf field string service = 1; + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CloudEndpoints::class, \Google\Cloud\Monitoring\V3\Service_CloudEndpoints::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudRun.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudRun.php new file mode 100644 index 000000000000..05dd1da04bf8 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/CloudRun.php @@ -0,0 +1,120 @@ +google.monitoring.v3.Service.CloudRun + */ +class CloudRun extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the Cloud Run service. Corresponds to the `service_name` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string service_name = 1; + */ + protected $service_name = ''; + /** + * The location the service is run. Corresponds to the `location` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string location = 2; + */ + protected $location = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_name + * The name of the Cloud Run service. Corresponds to the `service_name` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * @type string $location + * The location the service is run. Corresponds to the `location` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The name of the Cloud Run service. Corresponds to the `service_name` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string service_name = 1; + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * The name of the Cloud Run service. Corresponds to the `service_name` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string service_name = 1; + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + + /** + * The location the service is run. Corresponds to the `location` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location the service is run. Corresponds to the `location` + * resource label in the [`cloud_run_revision` monitored + * resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision). + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CloudRun::class, \Google\Cloud\Monitoring\V3\Service_CloudRun::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/ClusterIstio.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/ClusterIstio.php new file mode 100644 index 000000000000..bcbab5c1818c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/ClusterIstio.php @@ -0,0 +1,198 @@ +google.monitoring.v3.Service.ClusterIstio + */ +class ClusterIstio extends \Google\Protobuf\Internal\Message +{ + /** + * The location of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `location` resource label in `k8s_cluster` + * resources. + * + * Generated from protobuf field string location = 1; + */ + protected $location = ''; + /** + * The name of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `cluster_name` resource label in + * `k8s_cluster` resources. + * + * Generated from protobuf field string cluster_name = 2; + */ + protected $cluster_name = ''; + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + */ + protected $service_namespace = ''; + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + */ + protected $service_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The location of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `location` resource label in `k8s_cluster` + * resources. + * @type string $cluster_name + * The name of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `cluster_name` resource label in + * `k8s_cluster` resources. + * @type string $service_namespace + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * @type string $service_name + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The location of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `location` resource label in `k8s_cluster` + * resources. + * + * Generated from protobuf field string location = 1; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `location` resource label in `k8s_cluster` + * resources. + * + * Generated from protobuf field string location = 1; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The name of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `cluster_name` resource label in + * `k8s_cluster` resources. + * + * Generated from protobuf field string cluster_name = 2; + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * The name of the Kubernetes cluster in which this Istio service is + * defined. Corresponds to the `cluster_name` resource label in + * `k8s_cluster` resources. + * + * Generated from protobuf field string cluster_name = 2; + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + * @return string + */ + public function getServiceNamespace() + { + return $this->service_namespace; + } + + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + * @param string $var + * @return $this + */ + public function setServiceNamespace($var) + { + GPBUtil::checkString($var, True); + $this->service_namespace = $var; + + return $this; + } + + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ClusterIstio::class, \Google\Cloud\Monitoring\V3\Service_ClusterIstio::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Custom.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Custom.php new file mode 100644 index 000000000000..03fb8595f374 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Custom.php @@ -0,0 +1,38 @@ +google.monitoring.v3.Service.Custom + */ +class Custom extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Custom::class, \Google\Cloud\Monitoring\V3\Service_Custom::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeNamespace.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeNamespace.php new file mode 100644 index 000000000000..65c6e82d342d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeNamespace.php @@ -0,0 +1,182 @@ +google.monitoring.v3.Service.GkeNamespace + */ +class GkeNamespace extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $project_id = ''; + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + */ + protected $location = ''; + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + */ + protected $cluster_name = ''; + /** + * The name of this namespace. + * + * Generated from protobuf field string namespace_name = 4; + */ + protected $namespace_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * @type string $location + * The location of the parent cluster. This may be a zone or region. + * @type string $cluster_name + * The name of the parent cluster. + * @type string $namespace_name + * The name of this namespace. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * The name of this namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @return string + */ + public function getNamespaceName() + { + return $this->namespace_name; + } + + /** + * The name of this namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @param string $var + * @return $this + */ + public function setNamespaceName($var) + { + GPBUtil::checkString($var, True); + $this->namespace_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GkeNamespace::class, \Google\Cloud\Monitoring\V3\Service_GkeNamespace::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeService.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeService.php new file mode 100644 index 000000000000..4b9bbf7606d7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeService.php @@ -0,0 +1,219 @@ +google.monitoring.v3.Service.GkeService + */ +class GkeService extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $project_id = ''; + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + */ + protected $location = ''; + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + */ + protected $cluster_name = ''; + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + */ + protected $namespace_name = ''; + /** + * The name of this service. + * + * Generated from protobuf field string service_name = 5; + */ + protected $service_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * @type string $location + * The location of the parent cluster. This may be a zone or region. + * @type string $cluster_name + * The name of the parent cluster. + * @type string $namespace_name + * The name of the parent namespace. + * @type string $service_name + * The name of this service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @return string + */ + public function getNamespaceName() + { + return $this->namespace_name; + } + + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @param string $var + * @return $this + */ + public function setNamespaceName($var) + { + GPBUtil::checkString($var, True); + $this->namespace_name = $var; + + return $this; + } + + /** + * The name of this service. + * + * Generated from protobuf field string service_name = 5; + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * The name of this service. + * + * Generated from protobuf field string service_name = 5; + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GkeService::class, \Google\Cloud\Monitoring\V3\Service_GkeService::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeWorkload.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeWorkload.php new file mode 100644 index 000000000000..7ec62cebfe7a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/GkeWorkload.php @@ -0,0 +1,250 @@ +google.monitoring.v3.Service.GkeWorkload + */ +class GkeWorkload extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $project_id = ''; + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + */ + protected $location = ''; + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + */ + protected $cluster_name = ''; + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + */ + protected $namespace_name = ''; + /** + * The type of this workload (for example, "Deployment" or "DaemonSet") + * + * Generated from protobuf field string top_level_controller_type = 5; + */ + protected $top_level_controller_type = ''; + /** + * The name of this workload. + * + * Generated from protobuf field string top_level_controller_name = 6; + */ + protected $top_level_controller_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $project_id + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * @type string $location + * The location of the parent cluster. This may be a zone or region. + * @type string $cluster_name + * The name of the parent cluster. + * @type string $namespace_name + * The name of the parent namespace. + * @type string $top_level_controller_type + * The type of this workload (for example, "Deployment" or "DaemonSet") + * @type string $top_level_controller_name + * The name of this workload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Output only. The project this resource lives in. For legacy services + * migrated from the `Custom` type, this may be a distinct project from the + * one parenting the service itself. + * + * Generated from protobuf field string project_id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location of the parent cluster. This may be a zone or region. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * The name of the parent cluster. + * + * Generated from protobuf field string cluster_name = 3; + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @return string + */ + public function getNamespaceName() + { + return $this->namespace_name; + } + + /** + * The name of the parent namespace. + * + * Generated from protobuf field string namespace_name = 4; + * @param string $var + * @return $this + */ + public function setNamespaceName($var) + { + GPBUtil::checkString($var, True); + $this->namespace_name = $var; + + return $this; + } + + /** + * The type of this workload (for example, "Deployment" or "DaemonSet") + * + * Generated from protobuf field string top_level_controller_type = 5; + * @return string + */ + public function getTopLevelControllerType() + { + return $this->top_level_controller_type; + } + + /** + * The type of this workload (for example, "Deployment" or "DaemonSet") + * + * Generated from protobuf field string top_level_controller_type = 5; + * @param string $var + * @return $this + */ + public function setTopLevelControllerType($var) + { + GPBUtil::checkString($var, True); + $this->top_level_controller_type = $var; + + return $this; + } + + /** + * The name of this workload. + * + * Generated from protobuf field string top_level_controller_name = 6; + * @return string + */ + public function getTopLevelControllerName() + { + return $this->top_level_controller_name; + } + + /** + * The name of this workload. + * + * Generated from protobuf field string top_level_controller_name = 6; + * @param string $var + * @return $this + */ + public function setTopLevelControllerName($var) + { + GPBUtil::checkString($var, True); + $this->top_level_controller_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GkeWorkload::class, \Google\Cloud\Monitoring\V3\Service_GkeWorkload::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/IstioCanonicalService.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/IstioCanonicalService.php new file mode 100644 index 000000000000..0feb3f3aaa8c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/IstioCanonicalService.php @@ -0,0 +1,171 @@ += + * 1.6.8 will have their services ingested as this type. + * + * Generated from protobuf message google.monitoring.v3.Service.IstioCanonicalService + */ +class IstioCanonicalService extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier for the Istio mesh in which this canonical service is defined. + * Corresponds to the `mesh_uid` metric label in + * [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string mesh_uid = 1; + */ + protected $mesh_uid = ''; + /** + * The namespace of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_namespace` metric + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service_namespace = 3; + */ + protected $canonical_service_namespace = ''; + /** + * The name of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_name` metric label in + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service = 4; + */ + protected $canonical_service = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mesh_uid + * Identifier for the Istio mesh in which this canonical service is defined. + * Corresponds to the `mesh_uid` metric label in + * [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * @type string $canonical_service_namespace + * The namespace of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_namespace` metric + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * @type string $canonical_service + * The name of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_name` metric label in + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier for the Istio mesh in which this canonical service is defined. + * Corresponds to the `mesh_uid` metric label in + * [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string mesh_uid = 1; + * @return string + */ + public function getMeshUid() + { + return $this->mesh_uid; + } + + /** + * Identifier for the Istio mesh in which this canonical service is defined. + * Corresponds to the `mesh_uid` metric label in + * [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string mesh_uid = 1; + * @param string $var + * @return $this + */ + public function setMeshUid($var) + { + GPBUtil::checkString($var, True); + $this->mesh_uid = $var; + + return $this; + } + + /** + * The namespace of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_namespace` metric + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service_namespace = 3; + * @return string + */ + public function getCanonicalServiceNamespace() + { + return $this->canonical_service_namespace; + } + + /** + * The namespace of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_namespace` metric + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service_namespace = 3; + * @param string $var + * @return $this + */ + public function setCanonicalServiceNamespace($var) + { + GPBUtil::checkString($var, True); + $this->canonical_service_namespace = $var; + + return $this; + } + + /** + * The name of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_name` metric label in + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service = 4; + * @return string + */ + public function getCanonicalService() + { + return $this->canonical_service; + } + + /** + * The name of the canonical service underlying this service. + * Corresponds to the `destination_canonical_service_name` metric label in + * label in [Istio + * metrics](https://cloud.google.com/monitoring/api/metrics_istio). + * + * Generated from protobuf field string canonical_service = 4; + * @param string $var + * @return $this + */ + public function setCanonicalService($var) + { + GPBUtil::checkString($var, True); + $this->canonical_service = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IstioCanonicalService::class, \Google\Cloud\Monitoring\V3\Service_IstioCanonicalService::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/MeshIstio.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/MeshIstio.php new file mode 100644 index 000000000000..e90ac6f8b63a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/MeshIstio.php @@ -0,0 +1,151 @@ +google.monitoring.v3.Service.MeshIstio + */ +class MeshIstio extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier for the mesh in which this Istio service is defined. + * Corresponds to the `mesh_uid` metric label in Istio metrics. + * + * Generated from protobuf field string mesh_uid = 1; + */ + protected $mesh_uid = ''; + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + */ + protected $service_namespace = ''; + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + */ + protected $service_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mesh_uid + * Identifier for the mesh in which this Istio service is defined. + * Corresponds to the `mesh_uid` metric label in Istio metrics. + * @type string $service_namespace + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * @type string $service_name + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier for the mesh in which this Istio service is defined. + * Corresponds to the `mesh_uid` metric label in Istio metrics. + * + * Generated from protobuf field string mesh_uid = 1; + * @return string + */ + public function getMeshUid() + { + return $this->mesh_uid; + } + + /** + * Identifier for the mesh in which this Istio service is defined. + * Corresponds to the `mesh_uid` metric label in Istio metrics. + * + * Generated from protobuf field string mesh_uid = 1; + * @param string $var + * @return $this + */ + public function setMeshUid($var) + { + GPBUtil::checkString($var, True); + $this->mesh_uid = $var; + + return $this; + } + + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + * @return string + */ + public function getServiceNamespace() + { + return $this->service_namespace; + } + + /** + * The namespace of the Istio service underlying this service. Corresponds + * to the `destination_service_namespace` metric label in Istio metrics. + * + * Generated from protobuf field string service_namespace = 3; + * @param string $var + * @return $this + */ + public function setServiceNamespace($var) + { + GPBUtil::checkString($var, True); + $this->service_namespace = $var; + + return $this; + } + + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + * @return string + */ + public function getServiceName() + { + return $this->service_name; + } + + /** + * The name of the Istio service underlying this service. Corresponds to the + * `destination_service_name` metric label in Istio metrics. + * + * Generated from protobuf field string service_name = 4; + * @param string $var + * @return $this + */ + public function setServiceName($var) + { + GPBUtil::checkString($var, True); + $this->service_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MeshIstio::class, \Google\Cloud\Monitoring\V3\Service_MeshIstio::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Telemetry.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Telemetry.php new file mode 100644 index 000000000000..6bb4bd890866 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Service/Telemetry.php @@ -0,0 +1,74 @@ +google.monitoring.v3.Service.Telemetry + */ +class Telemetry extends \Google\Protobuf\Internal\Message +{ + /** + * The full name of the resource that defines this service. Formatted as + * described in https://cloud.google.com/apis/design/resource_names. + * + * Generated from protobuf field string resource_name = 1; + */ + protected $resource_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_name + * The full name of the resource that defines this service. Formatted as + * described in https://cloud.google.com/apis/design/resource_names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * The full name of the resource that defines this service. Formatted as + * described in https://cloud.google.com/apis/design/resource_names. + * + * Generated from protobuf field string resource_name = 1; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * The full name of the resource that defines this service. Formatted as + * described in https://cloud.google.com/apis/design/resource_names. + * + * Generated from protobuf field string resource_name = 1; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Telemetry::class, \Google\Cloud\Monitoring\V3\Service_Telemetry::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelIndicator.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelIndicator.php new file mode 100644 index 000000000000..a1d08a4e348f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelIndicator.php @@ -0,0 +1,153 @@ +google.monitoring.v3.ServiceLevelIndicator + */ +class ServiceLevelIndicator extends \Google\Protobuf\Internal\Message +{ + protected $type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\BasicSli $basic_sli + * Basic SLI on a well-known service type. + * @type \Google\Cloud\Monitoring\V3\RequestBasedSli $request_based + * Request-based SLIs + * @type \Google\Cloud\Monitoring\V3\WindowsBasedSli $windows_based + * Windows-based SLIs + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Basic SLI on a well-known service type. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli basic_sli = 4; + * @return \Google\Cloud\Monitoring\V3\BasicSli|null + */ + public function getBasicSli() + { + return $this->readOneof(4); + } + + public function hasBasicSli() + { + return $this->hasOneof(4); + } + + /** + * Basic SLI on a well-known service type. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli basic_sli = 4; + * @param \Google\Cloud\Monitoring\V3\BasicSli $var + * @return $this + */ + public function setBasicSli($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\BasicSli::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Request-based SLIs + * + * Generated from protobuf field .google.monitoring.v3.RequestBasedSli request_based = 1; + * @return \Google\Cloud\Monitoring\V3\RequestBasedSli|null + */ + public function getRequestBased() + { + return $this->readOneof(1); + } + + public function hasRequestBased() + { + return $this->hasOneof(1); + } + + /** + * Request-based SLIs + * + * Generated from protobuf field .google.monitoring.v3.RequestBasedSli request_based = 1; + * @param \Google\Cloud\Monitoring\V3\RequestBasedSli $var + * @return $this + */ + public function setRequestBased($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\RequestBasedSli::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Windows-based SLIs + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli windows_based = 2; + * @return \Google\Cloud\Monitoring\V3\WindowsBasedSli|null + */ + public function getWindowsBased() + { + return $this->readOneof(2); + } + + public function hasWindowsBased() + { + return $this->hasOneof(2); + } + + /** + * Windows-based SLIs + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli windows_based = 2; + * @param \Google\Cloud\Monitoring\V3\WindowsBasedSli $var + * @return $this + */ + public function setWindowsBased($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\WindowsBasedSli::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->whichOneof("type"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective.php new file mode 100644 index 000000000000..fa9e65f4985c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective.php @@ -0,0 +1,338 @@ +google.monitoring.v3.ServiceLevelObjective + */ +class ServiceLevelObjective extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Resource name for this `ServiceLevelObjective`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Name used for UI elements listing this SLO. + * + * Generated from protobuf field string display_name = 11; + */ + protected $display_name = ''; + /** + * The definition of good service, used to measure and calculate the quality + * of the `Service`'s performance with respect to a single aspect of service + * quality. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelIndicator service_level_indicator = 3; + */ + protected $service_level_indicator = null; + /** + * The fraction of service that must be good in order for this objective to be + * met. `0 < goal <= 0.9999`. + * + * Generated from protobuf field double goal = 4; + */ + protected $goal = 0.0; + /** + * Labels which have been used to annotate the service-level objective. Label + * keys must start with a letter. Label keys and values may contain lowercase + * letters, numbers, underscores, and dashes. Label keys and values have a + * maximum length of 63 characters, and must be less than 128 bytes in size. + * Up to 64 label entries may be stored. For labels which do not have a + * semantic value, the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 12; + */ + private $user_labels; + protected $period; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. Resource name for this `ServiceLevelObjective`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @type string $display_name + * Name used for UI elements listing this SLO. + * @type \Google\Cloud\Monitoring\V3\ServiceLevelIndicator $service_level_indicator + * The definition of good service, used to measure and calculate the quality + * of the `Service`'s performance with respect to a single aspect of service + * quality. + * @type float $goal + * The fraction of service that must be good in order for this objective to be + * met. `0 < goal <= 0.9999`. + * @type \Google\Protobuf\Duration $rolling_period + * A rolling time period, semantically "in the past ``". + * Must be an integer multiple of 1 day no larger than 30 days. + * @type int $calendar_period + * A calendar period, semantically "since the start of the current + * ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and + * `MONTH` are supported. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * Labels which have been used to annotate the service-level objective. Label + * keys must start with a letter. Label keys and values may contain lowercase + * letters, numbers, underscores, and dashes. Label keys and values have a + * maximum length of 63 characters, and must be less than 128 bytes in size. + * Up to 64 label entries may be stored. For labels which do not have a + * semantic value, the empty string may be supplied for the label value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. Resource name for this `ServiceLevelObjective`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Resource name for this `ServiceLevelObjective`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Name used for UI elements listing this SLO. + * + * Generated from protobuf field string display_name = 11; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Name used for UI elements listing this SLO. + * + * Generated from protobuf field string display_name = 11; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The definition of good service, used to measure and calculate the quality + * of the `Service`'s performance with respect to a single aspect of service + * quality. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelIndicator service_level_indicator = 3; + * @return \Google\Cloud\Monitoring\V3\ServiceLevelIndicator|null + */ + public function getServiceLevelIndicator() + { + return $this->service_level_indicator; + } + + public function hasServiceLevelIndicator() + { + return isset($this->service_level_indicator); + } + + public function clearServiceLevelIndicator() + { + unset($this->service_level_indicator); + } + + /** + * The definition of good service, used to measure and calculate the quality + * of the `Service`'s performance with respect to a single aspect of service + * quality. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelIndicator service_level_indicator = 3; + * @param \Google\Cloud\Monitoring\V3\ServiceLevelIndicator $var + * @return $this + */ + public function setServiceLevelIndicator($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\ServiceLevelIndicator::class); + $this->service_level_indicator = $var; + + return $this; + } + + /** + * The fraction of service that must be good in order for this objective to be + * met. `0 < goal <= 0.9999`. + * + * Generated from protobuf field double goal = 4; + * @return float + */ + public function getGoal() + { + return $this->goal; + } + + /** + * The fraction of service that must be good in order for this objective to be + * met. `0 < goal <= 0.9999`. + * + * Generated from protobuf field double goal = 4; + * @param float $var + * @return $this + */ + public function setGoal($var) + { + GPBUtil::checkDouble($var); + $this->goal = $var; + + return $this; + } + + /** + * A rolling time period, semantically "in the past ``". + * Must be an integer multiple of 1 day no larger than 30 days. + * + * Generated from protobuf field .google.protobuf.Duration rolling_period = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getRollingPeriod() + { + return $this->readOneof(5); + } + + public function hasRollingPeriod() + { + return $this->hasOneof(5); + } + + /** + * A rolling time period, semantically "in the past ``". + * Must be an integer multiple of 1 day no larger than 30 days. + * + * Generated from protobuf field .google.protobuf.Duration rolling_period = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRollingPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A calendar period, semantically "since the start of the current + * ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and + * `MONTH` are supported. + * + * Generated from protobuf field .google.type.CalendarPeriod calendar_period = 6; + * @return int + */ + public function getCalendarPeriod() + { + return $this->readOneof(6); + } + + public function hasCalendarPeriod() + { + return $this->hasOneof(6); + } + + /** + * A calendar period, semantically "since the start of the current + * ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and + * `MONTH` are supported. + * + * Generated from protobuf field .google.type.CalendarPeriod calendar_period = 6; + * @param int $var + * @return $this + */ + public function setCalendarPeriod($var) + { + GPBUtil::checkEnum($var, \Google\Type\CalendarPeriod::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Labels which have been used to annotate the service-level objective. Label + * keys must start with a letter. Label keys and values may contain lowercase + * letters, numbers, underscores, and dashes. Label keys and values have a + * maximum length of 63 characters, and must be less than 128 bytes in size. + * Up to 64 label entries may be stored. For labels which do not have a + * semantic value, the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * Labels which have been used to annotate the service-level objective. Label + * keys must start with a letter. Label keys and values may contain lowercase + * letters, numbers, underscores, and dashes. Label keys and values have a + * maximum length of 63 characters, and must be less than 128 bytes in size. + * Up to 64 label entries may be stored. For labels which do not have a + * semantic value, the empty string may be supplied for the label value. + * + * Generated from protobuf field map user_labels = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getPeriod() + { + return $this->whichOneof("period"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective/View.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective/View.php new file mode 100644 index 000000000000..a21fbcb25964 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceLevelObjective/View.php @@ -0,0 +1,71 @@ +google.monitoring.v3.ServiceLevelObjective.View + */ +class View +{ + /** + * Same as FULL. + * + * Generated from protobuf enum VIEW_UNSPECIFIED = 0; + */ + const VIEW_UNSPECIFIED = 0; + /** + * Return the embedded `ServiceLevelIndicator` in the form in which it was + * defined. If it was defined using a `BasicSli`, return that `BasicSli`. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + /** + * For `ServiceLevelIndicator`s using `BasicSli` articulation, instead + * return the `ServiceLevelIndicator` with its mode of computation fully + * spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using + * `RequestBasedSli` or `WindowsBasedSli`, return the + * `ServiceLevelIndicator` as it was provided. + * + * Generated from protobuf enum EXPLICIT = 1; + */ + const EXPLICIT = 1; + + private static $valueToName = [ + self::VIEW_UNSPECIFIED => 'VIEW_UNSPECIFIED', + self::FULL => 'FULL', + self::EXPLICIT => 'EXPLICIT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(View::class, \Google\Cloud\Monitoring\V3\ServiceLevelObjective_View::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceTier.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceTier.php new file mode 100644 index 000000000000..906682308486 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/ServiceTier.php @@ -0,0 +1,74 @@ +google.monitoring.v3.ServiceTier + */ +class ServiceTier +{ + /** + * An invalid sentinel value, used to indicate that a tier has not + * been provided explicitly. + * + * Generated from protobuf enum SERVICE_TIER_UNSPECIFIED = 0; + */ + const SERVICE_TIER_UNSPECIFIED = 0; + /** + * The Cloud Monitoring Basic tier, a free tier of service that provides basic + * features, a moderate allotment of logs, and access to built-in metrics. + * A number of features are not available in this tier. For more details, + * see [the service tiers + * documentation](https://cloud.google.com/monitoring/workspaces/tiers). + * + * Generated from protobuf enum SERVICE_TIER_BASIC = 1; + */ + const SERVICE_TIER_BASIC = 1; + /** + * The Cloud Monitoring Premium tier, a higher, more expensive tier of service + * that provides access to all Cloud Monitoring features, lets you use Cloud + * Monitoring with AWS accounts, and has a larger allotments for logs and + * metrics. For more details, see [the service tiers + * documentation](https://cloud.google.com/monitoring/workspaces/tiers). + * + * Generated from protobuf enum SERVICE_TIER_PREMIUM = 2; + */ + const SERVICE_TIER_PREMIUM = 2; + + private static $valueToName = [ + self::SERVICE_TIER_UNSPECIFIED => 'SERVICE_TIER_UNSPECIFIED', + self::SERVICE_TIER_BASIC => 'SERVICE_TIER_BASIC', + self::SERVICE_TIER_PREMIUM => 'SERVICE_TIER_PREMIUM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze.php new file mode 100644 index 000000000000..c5f17a47719f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze.php @@ -0,0 +1,224 @@ +google.monitoring.v3.Snooze + */ +class Snooze extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifier. The name of the `Snooze`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * The ID of the `Snooze` will be generated by the system. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Required. This defines the criteria for applying the `Snooze`. See + * `Criteria` for more information. + * + * Generated from protobuf field .google.monitoring.v3.Snooze.Criteria criteria = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $criteria = null; + /** + * Required. The `Snooze` will be active from `interval.start_time` through + * `interval.end_time`. + * `interval.start_time` cannot be in the past. There is a 15 second clock + * skew to account for the time it takes for a request to reach the API from + * the UI. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $interval = null; + /** + * Required. A display name for the `Snooze`. This can be, at most, 512 + * unicode characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Identifier. The name of the `Snooze`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * The ID of the `Snooze` will be generated by the system. + * @type \Google\Cloud\Monitoring\V3\Snooze\Criteria $criteria + * Required. This defines the criteria for applying the `Snooze`. See + * `Criteria` for more information. + * @type \Google\Cloud\Monitoring\V3\TimeInterval $interval + * Required. The `Snooze` will be active from `interval.start_time` through + * `interval.end_time`. + * `interval.start_time` cannot be in the past. There is a 15 second clock + * skew to account for the time it takes for a request to reach the API from + * the UI. + * @type string $display_name + * Required. A display name for the `Snooze`. This can be, at most, 512 + * unicode characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Snooze::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifier. The name of the `Snooze`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * The ID of the `Snooze` will be generated by the system. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Identifier. The name of the `Snooze`. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * The ID of the `Snooze` will be generated by the system. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. This defines the criteria for applying the `Snooze`. See + * `Criteria` for more information. + * + * Generated from protobuf field .google.monitoring.v3.Snooze.Criteria criteria = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Snooze\Criteria|null + */ + public function getCriteria() + { + return $this->criteria; + } + + public function hasCriteria() + { + return isset($this->criteria); + } + + public function clearCriteria() + { + unset($this->criteria); + } + + /** + * Required. This defines the criteria for applying the `Snooze`. See + * `Criteria` for more information. + * + * Generated from protobuf field .google.monitoring.v3.Snooze.Criteria criteria = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Snooze\Criteria $var + * @return $this + */ + public function setCriteria($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Snooze\Criteria::class); + $this->criteria = $var; + + return $this; + } + + /** + * Required. The `Snooze` will be active from `interval.start_time` through + * `interval.end_time`. + * `interval.start_time` cannot be in the past. There is a 15 second clock + * skew to account for the time it takes for a request to reach the API from + * the UI. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\TimeInterval|null + */ + public function getInterval() + { + return $this->interval; + } + + public function hasInterval() + { + return isset($this->interval); + } + + public function clearInterval() + { + unset($this->interval); + } + + /** + * Required. The `Snooze` will be active from `interval.start_time` through + * `interval.end_time`. + * `interval.start_time` cannot be in the past. There is a 15 second clock + * skew to account for the time it takes for a request to reach the API from + * the UI. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval interval = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\TimeInterval $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeInterval::class); + $this->interval = $var; + + return $this; + } + + /** + * Required. A display name for the `Snooze`. This can be, at most, 512 + * unicode characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. A display name for the `Snooze`. This can be, at most, 512 + * unicode characters. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze/Criteria.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze/Criteria.php new file mode 100644 index 000000000000..13e62c6c1855 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/Snooze/Criteria.php @@ -0,0 +1,88 @@ +google.monitoring.v3.Snooze.Criteria + */ +class Criteria extends \Google\Protobuf\Internal\Message +{ + /** + * The specific `AlertPolicy` names for the alert that should be snoozed. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] + * There is a limit of 16 policies per snooze. This limit is checked during + * snooze creation. + * + * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { + */ + private $policies; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $policies + * The specific `AlertPolicy` names for the alert that should be snoozed. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] + * There is a limit of 16 policies per snooze. This limit is checked during + * snooze creation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Snooze::initOnce(); + parent::__construct($data); + } + + /** + * The specific `AlertPolicy` names for the alert that should be snoozed. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] + * There is a limit of 16 policies per snooze. This limit is checked during + * snooze creation. + * + * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPolicies() + { + return $this->policies; + } + + /** + * The specific `AlertPolicy` names for the alert that should be snoozed. + * The format is: + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] + * There is a limit of 16 policies per snooze. This limit is checked during + * snooze creation. + * + * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->policies = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Criteria::class, \Google\Cloud\Monitoring\V3\Snooze_Criteria::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SpanContext.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SpanContext.php new file mode 100644 index 000000000000..cfeb31ba8340 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SpanContext.php @@ -0,0 +1,91 @@ +google.monitoring.v3.SpanContext + */ +class SpanContext extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the span. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. + * + * Generated from protobuf field string span_name = 1; + */ + protected $span_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $span_name + * The resource name of the span. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SpanContext::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the span. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. + * + * Generated from protobuf field string span_name = 1; + * @return string + */ + public function getSpanName() + { + return $this->span_name; + } + + /** + * The resource name of the span. The format is: + * projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. + * + * Generated from protobuf field string span_name = 1; + * @param string $var + * @return $this + */ + public function setSpanName($var) + { + GPBUtil::checkString($var, True); + $this->span_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget.php new file mode 100644 index 000000000000..8bbfac0f1098 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget.php @@ -0,0 +1,75 @@ +google.monitoring.v3.SyntheticMonitorTarget + */ +class SyntheticMonitorTarget extends \Google\Protobuf\Internal\Message +{ + protected $target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget\CloudFunctionV2Target $cloud_function_v2 + * Target a Synthetic Monitor GCFv2 instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * Target a Synthetic Monitor GCFv2 instance. + * + * Generated from protobuf field .google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target cloud_function_v2 = 1; + * @return \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget\CloudFunctionV2Target|null + */ + public function getCloudFunctionV2() + { + return $this->readOneof(1); + } + + public function hasCloudFunctionV2() + { + return $this->hasOneof(1); + } + + /** + * Target a Synthetic Monitor GCFv2 instance. + * + * Generated from protobuf field .google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target cloud_function_v2 = 1; + * @param \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget\CloudFunctionV2Target $var + * @return $this + */ + public function setCloudFunctionV2($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget\CloudFunctionV2Target::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget/CloudFunctionV2Target.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget/CloudFunctionV2Target.php new file mode 100644 index 000000000000..1f9b8d546857 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/SyntheticMonitorTarget/CloudFunctionV2Target.php @@ -0,0 +1,134 @@ +google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target + */ +class CloudFunctionV2Target extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Fully qualified GCFv2 resource name + * i.e. `projects/{project}/locations/{location}/functions/{function}` + * Required. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Output only. The `cloud_run_revision` Monitored Resource associated with + * the GCFv2. The Synthetic Monitor execution results (metrics, logs, and + * spans) are reported against this Monitored Resource. This field is output + * only. + * + * Generated from protobuf field .google.api.MonitoredResource cloud_run_revision = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cloud_run_revision = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Fully qualified GCFv2 resource name + * i.e. `projects/{project}/locations/{location}/functions/{function}` + * Required. + * @type \Google\Api\MonitoredResource $cloud_run_revision + * Output only. The `cloud_run_revision` Monitored Resource associated with + * the GCFv2. The Synthetic Monitor execution results (metrics, logs, and + * spans) are reported against this Monitored Resource. This field is output + * only. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * Required. Fully qualified GCFv2 resource name + * i.e. `projects/{project}/locations/{location}/functions/{function}` + * Required. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Fully qualified GCFv2 resource name + * i.e. `projects/{project}/locations/{location}/functions/{function}` + * Required. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The `cloud_run_revision` Monitored Resource associated with + * the GCFv2. The Synthetic Monitor execution results (metrics, logs, and + * spans) are reported against this Monitored Resource. This field is output + * only. + * + * Generated from protobuf field .google.api.MonitoredResource cloud_run_revision = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Api\MonitoredResource|null + */ + public function getCloudRunRevision() + { + return $this->cloud_run_revision; + } + + public function hasCloudRunRevision() + { + return isset($this->cloud_run_revision); + } + + public function clearCloudRunRevision() + { + unset($this->cloud_run_revision); + } + + /** + * Output only. The `cloud_run_revision` Monitored Resource associated with + * the GCFv2. The Synthetic Monitor execution results (metrics, logs, and + * spans) are reported against this Monitored Resource. This field is output + * only. + * + * Generated from protobuf field .google.api.MonitoredResource cloud_run_revision = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Api\MonitoredResource $var + * @return $this + */ + public function setCloudRunRevision($var) + { + GPBUtil::checkMessage($var, \Google\Api\MonitoredResource::class); + $this->cloud_run_revision = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CloudFunctionV2Target::class, \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget_CloudFunctionV2Target::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator.php new file mode 100644 index 000000000000..6c6c82460c63 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator.php @@ -0,0 +1,303 @@ +google.monitoring.v3.TextLocator + */ +class TextLocator extends \Google\Protobuf\Internal\Message +{ + /** + * The source of the text. The source may be a field in the request, in which + * case its format is the format of the + * google.rpc.BadRequest.FieldViolation.field field in + * https://cloud.google.com/apis/design/errors#error_details. It may also be + * be a source other than the request field (e.g. a macro definition + * referenced in the text of the query), in which case this is the name of + * the source (e.g. the macro name). + * + * Generated from protobuf field string source = 1; + */ + protected $source = ''; + /** + * The position of the first byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position start_position = 2; + */ + protected $start_position = null; + /** + * The position of the last byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position end_position = 3; + */ + protected $end_position = null; + /** + * If `source`, `start_position`, and `end_position` describe a call on + * some object (e.g. a macro in the time series query language text) and a + * location is to be designated in that object's text, `nested_locator` + * identifies the location within that object. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator nested_locator = 4; + */ + protected $nested_locator = null; + /** + * When `nested_locator` is set, this field gives the reason for the nesting. + * Usually, the reason is a macro invocation. In that case, the macro name + * (including the leading '@') signals the location of the macro call + * in the text and a macro argument name (including the leading '$') signals + * the location of the macro argument inside the macro body that got + * substituted away. + * + * Generated from protobuf field string nesting_reason = 5; + */ + protected $nesting_reason = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $source + * The source of the text. The source may be a field in the request, in which + * case its format is the format of the + * google.rpc.BadRequest.FieldViolation.field field in + * https://cloud.google.com/apis/design/errors#error_details. It may also be + * be a source other than the request field (e.g. a macro definition + * referenced in the text of the query), in which case this is the name of + * the source (e.g. the macro name). + * @type \Google\Cloud\Monitoring\V3\TextLocator\Position $start_position + * The position of the first byte within the text. + * @type \Google\Cloud\Monitoring\V3\TextLocator\Position $end_position + * The position of the last byte within the text. + * @type \Google\Cloud\Monitoring\V3\TextLocator $nested_locator + * If `source`, `start_position`, and `end_position` describe a call on + * some object (e.g. a macro in the time series query language text) and a + * location is to be designated in that object's text, `nested_locator` + * identifies the location within that object. + * @type string $nesting_reason + * When `nested_locator` is set, this field gives the reason for the nesting. + * Usually, the reason is a macro invocation. In that case, the macro name + * (including the leading '@') signals the location of the macro call + * in the text and a macro argument name (including the leading '$') signals + * the location of the macro argument inside the macro body that got + * substituted away. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The source of the text. The source may be a field in the request, in which + * case its format is the format of the + * google.rpc.BadRequest.FieldViolation.field field in + * https://cloud.google.com/apis/design/errors#error_details. It may also be + * be a source other than the request field (e.g. a macro definition + * referenced in the text of the query), in which case this is the name of + * the source (e.g. the macro name). + * + * Generated from protobuf field string source = 1; + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * The source of the text. The source may be a field in the request, in which + * case its format is the format of the + * google.rpc.BadRequest.FieldViolation.field field in + * https://cloud.google.com/apis/design/errors#error_details. It may also be + * be a source other than the request field (e.g. a macro definition + * referenced in the text of the query), in which case this is the name of + * the source (e.g. the macro name). + * + * Generated from protobuf field string source = 1; + * @param string $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkString($var, True); + $this->source = $var; + + return $this; + } + + /** + * The position of the first byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position start_position = 2; + * @return \Google\Cloud\Monitoring\V3\TextLocator\Position|null + */ + public function getStartPosition() + { + return $this->start_position; + } + + public function hasStartPosition() + { + return isset($this->start_position); + } + + public function clearStartPosition() + { + unset($this->start_position); + } + + /** + * The position of the first byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position start_position = 2; + * @param \Google\Cloud\Monitoring\V3\TextLocator\Position $var + * @return $this + */ + public function setStartPosition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TextLocator\Position::class); + $this->start_position = $var; + + return $this; + } + + /** + * The position of the last byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position end_position = 3; + * @return \Google\Cloud\Monitoring\V3\TextLocator\Position|null + */ + public function getEndPosition() + { + return $this->end_position; + } + + public function hasEndPosition() + { + return isset($this->end_position); + } + + public function clearEndPosition() + { + unset($this->end_position); + } + + /** + * The position of the last byte within the text. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator.Position end_position = 3; + * @param \Google\Cloud\Monitoring\V3\TextLocator\Position $var + * @return $this + */ + public function setEndPosition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TextLocator\Position::class); + $this->end_position = $var; + + return $this; + } + + /** + * If `source`, `start_position`, and `end_position` describe a call on + * some object (e.g. a macro in the time series query language text) and a + * location is to be designated in that object's text, `nested_locator` + * identifies the location within that object. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator nested_locator = 4; + * @return \Google\Cloud\Monitoring\V3\TextLocator|null + */ + public function getNestedLocator() + { + return $this->nested_locator; + } + + public function hasNestedLocator() + { + return isset($this->nested_locator); + } + + public function clearNestedLocator() + { + unset($this->nested_locator); + } + + /** + * If `source`, `start_position`, and `end_position` describe a call on + * some object (e.g. a macro in the time series query language text) and a + * location is to be designated in that object's text, `nested_locator` + * identifies the location within that object. + * + * Generated from protobuf field .google.monitoring.v3.TextLocator nested_locator = 4; + * @param \Google\Cloud\Monitoring\V3\TextLocator $var + * @return $this + */ + public function setNestedLocator($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TextLocator::class); + $this->nested_locator = $var; + + return $this; + } + + /** + * When `nested_locator` is set, this field gives the reason for the nesting. + * Usually, the reason is a macro invocation. In that case, the macro name + * (including the leading '@') signals the location of the macro call + * in the text and a macro argument name (including the leading '$') signals + * the location of the macro argument inside the macro body that got + * substituted away. + * + * Generated from protobuf field string nesting_reason = 5; + * @return string + */ + public function getNestingReason() + { + return $this->nesting_reason; + } + + /** + * When `nested_locator` is set, this field gives the reason for the nesting. + * Usually, the reason is a macro invocation. In that case, the macro name + * (including the leading '@') signals the location of the macro call + * in the text and a macro argument name (including the leading '$') signals + * the location of the macro argument inside the macro body that got + * substituted away. + * + * Generated from protobuf field string nesting_reason = 5; + * @param string $var + * @return $this + */ + public function setNestingReason($var) + { + GPBUtil::checkString($var, True); + $this->nesting_reason = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator/Position.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator/Position.php new file mode 100644 index 000000000000..bd81e7bff71b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TextLocator/Position.php @@ -0,0 +1,108 @@ +google.monitoring.v3.TextLocator.Position + */ +class Position extends \Google\Protobuf\Internal\Message +{ + /** + * The line, starting with 1, where the byte is positioned. + * + * Generated from protobuf field int32 line = 1; + */ + protected $line = 0; + /** + * The column within the line, starting with 1, where the byte is + * positioned. This is a byte index even though the text is UTF-8. + * + * Generated from protobuf field int32 column = 2; + */ + protected $column = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $line + * The line, starting with 1, where the byte is positioned. + * @type int $column + * The column within the line, starting with 1, where the byte is + * positioned. This is a byte index even though the text is UTF-8. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The line, starting with 1, where the byte is positioned. + * + * Generated from protobuf field int32 line = 1; + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * The line, starting with 1, where the byte is positioned. + * + * Generated from protobuf field int32 line = 1; + * @param int $var + * @return $this + */ + public function setLine($var) + { + GPBUtil::checkInt32($var); + $this->line = $var; + + return $this; + } + + /** + * The column within the line, starting with 1, where the byte is + * positioned. This is a byte index even though the text is UTF-8. + * + * Generated from protobuf field int32 column = 2; + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * The column within the line, starting with 1, where the byte is + * positioned. This is a byte index even though the text is UTF-8. + * + * Generated from protobuf field int32 column = 2; + * @param int $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkInt32($var); + $this->column = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Position::class, \Google\Cloud\Monitoring\V3\TextLocator_Position::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeInterval.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeInterval.php new file mode 100644 index 000000000000..1869cd41c8a9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeInterval.php @@ -0,0 +1,165 @@ +google.monitoring.v3.TimeInterval + */ +class TimeInterval extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The end of the time interval. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Optional. The beginning of the time interval. The default value + * for the start time is the end time. The start time must not be + * later than the end time. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $end_time + * Required. The end of the time interval. + * @type \Google\Protobuf\Timestamp $start_time + * Optional. The beginning of the time interval. The default value + * for the start time is the end time. The start time must not be + * later than the end time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. The end of the time interval. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Required. The end of the time interval. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Optional. The beginning of the time interval. The default value + * for the start time is the end time. The start time must not be + * later than the end time. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Optional. The beginning of the time interval. The default value + * for the start time is the end time. The start time must not be + * later than the end time. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeries.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeries.php new file mode 100644 index 000000000000..0e327025f0d8 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeries.php @@ -0,0 +1,454 @@ +google.monitoring.v3.TimeSeries + */ +class TimeSeries extends \Google\Protobuf\Internal\Message +{ + /** + * The associated metric. A fully-specified metric used to identify the time + * series. + * + * Generated from protobuf field .google.api.Metric metric = 1; + */ + protected $metric = null; + /** + * The associated monitored resource. Custom metrics can use only certain + * monitored resource types in their time series data. For more information, + * see [Monitored resources for custom + * metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources). + * + * Generated from protobuf field .google.api.MonitoredResource resource = 2; + */ + protected $resource = null; + /** + * Output only. The associated monitored resource metadata. When reading a + * time series, this field will include metadata labels that are explicitly + * named in the reduction. When creating a time series, this field is ignored. + * + * Generated from protobuf field .google.api.MonitoredResourceMetadata metadata = 7; + */ + protected $metadata = null; + /** + * The metric kind of the time series. When listing time series, this metric + * kind might be different from the metric kind of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the metric kind of the associated metric. If the associated + * metric's descriptor must be auto-created, then this field specifies the + * metric kind of the new descriptor and must be either `GAUGE` (the default) + * or `CUMULATIVE`. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + */ + protected $metric_kind = 0; + /** + * The value type of the time series. When listing time series, this value + * type might be different from the value type of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the type of the data in the `points` field. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + */ + protected $value_type = 0; + /** + * The data points of this time series. When listing time series, points are + * returned in reverse time order. + * When creating a time series, this field must contain exactly one point and + * the point's type must be the same as the value type of the associated + * metric. If the associated metric's descriptor must be auto-created, then + * the value type of the descriptor is determined by the point's type, which + * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + * + * Generated from protobuf field repeated .google.monitoring.v3.Point points = 5; + */ + private $points; + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. This field can only + * be changed through CreateTimeSeries when it is empty. + * + * Generated from protobuf field string unit = 8; + */ + protected $unit = ''; + /** + * Input only. A detailed description of the time series that will be + * associated with the + * [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric. + * Once set, this field cannot be changed through CreateTimeSeries. + * + * Generated from protobuf field string description = 9; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Api\Metric $metric + * The associated metric. A fully-specified metric used to identify the time + * series. + * @type \Google\Api\MonitoredResource $resource + * The associated monitored resource. Custom metrics can use only certain + * monitored resource types in their time series data. For more information, + * see [Monitored resources for custom + * metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources). + * @type \Google\Api\MonitoredResourceMetadata $metadata + * Output only. The associated monitored resource metadata. When reading a + * time series, this field will include metadata labels that are explicitly + * named in the reduction. When creating a time series, this field is ignored. + * @type int $metric_kind + * The metric kind of the time series. When listing time series, this metric + * kind might be different from the metric kind of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the metric kind of the associated metric. If the associated + * metric's descriptor must be auto-created, then this field specifies the + * metric kind of the new descriptor and must be either `GAUGE` (the default) + * or `CUMULATIVE`. + * @type int $value_type + * The value type of the time series. When listing time series, this value + * type might be different from the value type of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the type of the data in the `points` field. + * @type array<\Google\Cloud\Monitoring\V3\Point>|\Google\Protobuf\Internal\RepeatedField $points + * The data points of this time series. When listing time series, points are + * returned in reverse time order. + * When creating a time series, this field must contain exactly one point and + * the point's type must be the same as the value type of the associated + * metric. If the associated metric's descriptor must be auto-created, then + * the value type of the descriptor is determined by the point's type, which + * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + * @type string $unit + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. This field can only + * be changed through CreateTimeSeries when it is empty. + * @type string $description + * Input only. A detailed description of the time series that will be + * associated with the + * [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric. + * Once set, this field cannot be changed through CreateTimeSeries. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The associated metric. A fully-specified metric used to identify the time + * series. + * + * Generated from protobuf field .google.api.Metric metric = 1; + * @return \Google\Api\Metric|null + */ + public function getMetric() + { + return $this->metric; + } + + public function hasMetric() + { + return isset($this->metric); + } + + public function clearMetric() + { + unset($this->metric); + } + + /** + * The associated metric. A fully-specified metric used to identify the time + * series. + * + * Generated from protobuf field .google.api.Metric metric = 1; + * @param \Google\Api\Metric $var + * @return $this + */ + public function setMetric($var) + { + GPBUtil::checkMessage($var, \Google\Api\Metric::class); + $this->metric = $var; + + return $this; + } + + /** + * The associated monitored resource. Custom metrics can use only certain + * monitored resource types in their time series data. For more information, + * see [Monitored resources for custom + * metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources). + * + * Generated from protobuf field .google.api.MonitoredResource resource = 2; + * @return \Google\Api\MonitoredResource|null + */ + public function getResource() + { + return $this->resource; + } + + public function hasResource() + { + return isset($this->resource); + } + + public function clearResource() + { + unset($this->resource); + } + + /** + * The associated monitored resource. Custom metrics can use only certain + * monitored resource types in their time series data. For more information, + * see [Monitored resources for custom + * metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources). + * + * Generated from protobuf field .google.api.MonitoredResource resource = 2; + * @param \Google\Api\MonitoredResource $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkMessage($var, \Google\Api\MonitoredResource::class); + $this->resource = $var; + + return $this; + } + + /** + * Output only. The associated monitored resource metadata. When reading a + * time series, this field will include metadata labels that are explicitly + * named in the reduction. When creating a time series, this field is ignored. + * + * Generated from protobuf field .google.api.MonitoredResourceMetadata metadata = 7; + * @return \Google\Api\MonitoredResourceMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Output only. The associated monitored resource metadata. When reading a + * time series, this field will include metadata labels that are explicitly + * named in the reduction. When creating a time series, this field is ignored. + * + * Generated from protobuf field .google.api.MonitoredResourceMetadata metadata = 7; + * @param \Google\Api\MonitoredResourceMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Api\MonitoredResourceMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * The metric kind of the time series. When listing time series, this metric + * kind might be different from the metric kind of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the metric kind of the associated metric. If the associated + * metric's descriptor must be auto-created, then this field specifies the + * metric kind of the new descriptor and must be either `GAUGE` (the default) + * or `CUMULATIVE`. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @return int + */ + public function getMetricKind() + { + return $this->metric_kind; + } + + /** + * The metric kind of the time series. When listing time series, this metric + * kind might be different from the metric kind of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the metric kind of the associated metric. If the associated + * metric's descriptor must be auto-created, then this field specifies the + * metric kind of the new descriptor and must be either `GAUGE` (the default) + * or `CUMULATIVE`. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @param int $var + * @return $this + */ + public function setMetricKind($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\MetricKind::class); + $this->metric_kind = $var; + + return $this; + } + + /** + * The value type of the time series. When listing time series, this value + * type might be different from the value type of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the type of the data in the `points` field. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * The value type of the time series. When listing time series, this value + * type might be different from the value type of the associated metric if + * this time series is an alignment or reduction of other time series. + * When creating a time series, this field is optional. If present, it must be + * the same as the type of the data in the `points` field. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * The data points of this time series. When listing time series, points are + * returned in reverse time order. + * When creating a time series, this field must contain exactly one point and + * the point's type must be the same as the value type of the associated + * metric. If the associated metric's descriptor must be auto-created, then + * the value type of the descriptor is determined by the point's type, which + * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + * + * Generated from protobuf field repeated .google.monitoring.v3.Point points = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPoints() + { + return $this->points; + } + + /** + * The data points of this time series. When listing time series, points are + * returned in reverse time order. + * When creating a time series, this field must contain exactly one point and + * the point's type must be the same as the value type of the associated + * metric. If the associated metric's descriptor must be auto-created, then + * the value type of the descriptor is determined by the point's type, which + * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + * + * Generated from protobuf field repeated .google.monitoring.v3.Point points = 5; + * @param array<\Google\Cloud\Monitoring\V3\Point>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Point::class); + $this->points = $arr; + + return $this; + } + + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. This field can only + * be changed through CreateTimeSeries when it is empty. + * + * Generated from protobuf field string unit = 8; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * The units in which the metric value is reported. It is only applicable + * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + * defines the representation of the stored metric values. This field can only + * be changed through CreateTimeSeries when it is empty. + * + * Generated from protobuf field string unit = 8; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + + /** + * Input only. A detailed description of the time series that will be + * associated with the + * [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric. + * Once set, this field cannot be changed through CreateTimeSeries. + * + * Generated from protobuf field string description = 9; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Input only. A detailed description of the time series that will be + * associated with the + * [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric. + * Once set, this field cannot be changed through CreateTimeSeries. + * + * Generated from protobuf field string description = 9; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData.php new file mode 100644 index 000000000000..4c91cd6c80ab --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData.php @@ -0,0 +1,114 @@ +google.monitoring.v3.TimeSeriesData + */ +class TimeSeriesData extends \Google\Protobuf\Internal\Message +{ + /** + * The values of the labels in the time series identifier, given in the same + * order as the `label_descriptors` field of the TimeSeriesDescriptor + * associated with this object. Each value must have a value of the type + * given in the corresponding entry of `label_descriptors`. + * + * Generated from protobuf field repeated .google.monitoring.v3.LabelValue label_values = 1; + */ + private $label_values; + /** + * The points in the time series. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData.PointData point_data = 2; + */ + private $point_data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\LabelValue>|\Google\Protobuf\Internal\RepeatedField $label_values + * The values of the labels in the time series identifier, given in the same + * order as the `label_descriptors` field of the TimeSeriesDescriptor + * associated with this object. Each value must have a value of the type + * given in the corresponding entry of `label_descriptors`. + * @type array<\Google\Cloud\Monitoring\V3\TimeSeriesData\PointData>|\Google\Protobuf\Internal\RepeatedField $point_data + * The points in the time series. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The values of the labels in the time series identifier, given in the same + * order as the `label_descriptors` field of the TimeSeriesDescriptor + * associated with this object. Each value must have a value of the type + * given in the corresponding entry of `label_descriptors`. + * + * Generated from protobuf field repeated .google.monitoring.v3.LabelValue label_values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelValues() + { + return $this->label_values; + } + + /** + * The values of the labels in the time series identifier, given in the same + * order as the `label_descriptors` field of the TimeSeriesDescriptor + * associated with this object. Each value must have a value of the type + * given in the corresponding entry of `label_descriptors`. + * + * Generated from protobuf field repeated .google.monitoring.v3.LabelValue label_values = 1; + * @param array<\Google\Cloud\Monitoring\V3\LabelValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\LabelValue::class); + $this->label_values = $arr; + + return $this; + } + + /** + * The points in the time series. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData.PointData point_data = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPointData() + { + return $this->point_data; + } + + /** + * The points in the time series. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesData.PointData point_data = 2; + * @param array<\Google\Cloud\Monitoring\V3\TimeSeriesData\PointData>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPointData($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeriesData\PointData::class); + $this->point_data = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData/PointData.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData/PointData.php new file mode 100644 index 000000000000..9aa86421aa77 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesData/PointData.php @@ -0,0 +1,116 @@ +google.monitoring.v3.TimeSeriesData.PointData + */ +class PointData extends \Google\Protobuf\Internal\Message +{ + /** + * The values that make up the point. + * + * Generated from protobuf field repeated .google.monitoring.v3.TypedValue values = 1; + */ + private $values; + /** + * The time interval associated with the point. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval time_interval = 2; + */ + protected $time_interval = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Monitoring\V3\TypedValue>|\Google\Protobuf\Internal\RepeatedField $values + * The values that make up the point. + * @type \Google\Cloud\Monitoring\V3\TimeInterval $time_interval + * The time interval associated with the point. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The values that make up the point. + * + * Generated from protobuf field repeated .google.monitoring.v3.TypedValue values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The values that make up the point. + * + * Generated from protobuf field repeated .google.monitoring.v3.TypedValue values = 1; + * @param array<\Google\Cloud\Monitoring\V3\TypedValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TypedValue::class); + $this->values = $arr; + + return $this; + } + + /** + * The time interval associated with the point. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval time_interval = 2; + * @return \Google\Cloud\Monitoring\V3\TimeInterval|null + */ + public function getTimeInterval() + { + return $this->time_interval; + } + + public function hasTimeInterval() + { + return isset($this->time_interval); + } + + public function clearTimeInterval() + { + unset($this->time_interval); + } + + /** + * The time interval associated with the point. + * + * Generated from protobuf field .google.monitoring.v3.TimeInterval time_interval = 2; + * @param \Google\Cloud\Monitoring\V3\TimeInterval $var + * @return $this + */ + public function setTimeInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TimeInterval::class); + $this->time_interval = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PointData::class, \Google\Cloud\Monitoring\V3\TimeSeriesData_PointData::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor.php new file mode 100644 index 000000000000..ec714c4abc24 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor.php @@ -0,0 +1,101 @@ +google.monitoring.v3.TimeSeriesDescriptor + */ +class TimeSeriesDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * Descriptors for the labels. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor label_descriptors = 1; + */ + private $label_descriptors; + /** + * Descriptors for the point data value columns. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor point_descriptors = 5; + */ + private $point_descriptors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $label_descriptors + * Descriptors for the labels. + * @type array<\Google\Cloud\Monitoring\V3\TimeSeriesDescriptor\ValueDescriptor>|\Google\Protobuf\Internal\RepeatedField $point_descriptors + * Descriptors for the point data value columns. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * Descriptors for the labels. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor label_descriptors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelDescriptors() + { + return $this->label_descriptors; + } + + /** + * Descriptors for the labels. + * + * Generated from protobuf field repeated .google.api.LabelDescriptor label_descriptors = 1; + * @param array<\Google\Api\LabelDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelDescriptors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); + $this->label_descriptors = $arr; + + return $this; + } + + /** + * Descriptors for the point data value columns. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor point_descriptors = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPointDescriptors() + { + return $this->point_descriptors; + } + + /** + * Descriptors for the point data value columns. + * + * Generated from protobuf field repeated .google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor point_descriptors = 5; + * @param array<\Google\Cloud\Monitoring\V3\TimeSeriesDescriptor\ValueDescriptor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPointDescriptors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor\ValueDescriptor::class); + $this->point_descriptors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor/ValueDescriptor.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor/ValueDescriptor.php new file mode 100644 index 000000000000..ac5dbc3a79e6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesDescriptor/ValueDescriptor.php @@ -0,0 +1,184 @@ +google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + */ +class ValueDescriptor extends \Google\Protobuf\Internal\Message +{ + /** + * The value key. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The value type. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 2; + */ + protected $value_type = 0; + /** + * The value stream kind. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + */ + protected $metric_kind = 0; + /** + * The unit in which `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION. + * + * Generated from protobuf field string unit = 4; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The value key. + * @type int $value_type + * The value type. + * @type int $metric_kind + * The value stream kind. + * @type string $unit + * The unit in which `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Metric::initOnce(); + parent::__construct($data); + } + + /** + * The value key. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The value key. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value type. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 2; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * The value type. + * + * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 2; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * The value stream kind. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @return int + */ + public function getMetricKind() + { + return $this->metric_kind; + } + + /** + * The value stream kind. + * + * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; + * @param int $var + * @return $this + */ + public function setMetricKind($var) + { + GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\MetricKind::class); + $this->metric_kind = $var; + + return $this; + } + + /** + * The unit in which `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION. + * + * Generated from protobuf field string unit = 4; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * The unit in which `time_series` point values are reported. `unit` + * follows the UCUM format for units as seen in + * https://unitsofmeasure.org/ucum.html. + * `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION. + * + * Generated from protobuf field string unit = 4; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ValueDescriptor::class, \Google\Cloud\Monitoring\V3\TimeSeriesDescriptor_ValueDescriptor::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesRatio.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesRatio.php new file mode 100644 index 000000000000..bbd4edb9bac9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TimeSeriesRatio.php @@ -0,0 +1,180 @@ +google.monitoring.v3.TimeSeriesRatio + */ +class TimeSeriesRatio extends \Google\Protobuf\Internal\Message +{ + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying good service provided. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string good_service_filter = 4; + */ + protected $good_service_filter = ''; + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying bad service, either demanded service + * that was not provided or demanded service that was of inadequate quality. + * Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have + * `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string bad_service_filter = 5; + */ + protected $bad_service_filter = ''; + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying total demanded service. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string total_service_filter = 6; + */ + protected $total_service_filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $good_service_filter + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying good service provided. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * @type string $bad_service_filter + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying bad service, either demanded service + * that was not provided or demanded service that was of inadequate quality. + * Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have + * `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * @type string $total_service_filter + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying total demanded service. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying good service provided. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string good_service_filter = 4; + * @return string + */ + public function getGoodServiceFilter() + { + return $this->good_service_filter; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying good service provided. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string good_service_filter = 4; + * @param string $var + * @return $this + */ + public function setGoodServiceFilter($var) + { + GPBUtil::checkString($var, True); + $this->good_service_filter = $var; + + return $this; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying bad service, either demanded service + * that was not provided or demanded service that was of inadequate quality. + * Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have + * `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string bad_service_filter = 5; + * @return string + */ + public function getBadServiceFilter() + { + return $this->bad_service_filter; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying bad service, either demanded service + * that was not provided or demanded service that was of inadequate quality. + * Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have + * `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string bad_service_filter = 5; + * @param string $var + * @return $this + */ + public function setBadServiceFilter($var) + { + GPBUtil::checkString($var, True); + $this->bad_service_filter = $var; + + return $this; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying total demanded service. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string total_service_filter = 6; + * @return string + */ + public function getTotalServiceFilter() + { + return $this->total_service_filter; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` quantifying total demanded service. Must have + * `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + * DELTA` or `MetricKind = CUMULATIVE`. + * + * Generated from protobuf field string total_service_filter = 6; + * @param string $var + * @return $this + */ + public function setTotalServiceFilter($var) + { + GPBUtil::checkString($var, True); + $this->total_service_filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TypedValue.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TypedValue.php new file mode 100644 index 000000000000..866bd8da0167 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/TypedValue.php @@ -0,0 +1,213 @@ +google.monitoring.v3.TypedValue + */ +class TypedValue extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $bool_value + * A Boolean value: `true` or `false`. + * @type int|string $int64_value + * A 64-bit integer. Its range is approximately ±9.2x1018. + * @type float $double_value + * A 64-bit double-precision floating-point number. Its magnitude + * is approximately ±10±300 and it has 16 + * significant digits of precision. + * @type string $string_value + * A variable-length string value. + * @type \Google\Api\Distribution $distribution_value + * A distribution value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * A Boolean value: `true` or `false`. + * + * Generated from protobuf field bool bool_value = 1; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(1); + } + + public function hasBoolValue() + { + return $this->hasOneof(1); + } + + /** + * A Boolean value: `true` or `false`. + * + * Generated from protobuf field bool bool_value = 1; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A 64-bit integer. Its range is approximately ±9.2x1018. + * + * Generated from protobuf field int64 int64_value = 2; + * @return int|string + */ + public function getInt64Value() + { + return $this->readOneof(2); + } + + public function hasInt64Value() + { + return $this->hasOneof(2); + } + + /** + * A 64-bit integer. Its range is approximately ±9.2x1018. + * + * Generated from protobuf field int64 int64_value = 2; + * @param int|string $var + * @return $this + */ + public function setInt64Value($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A 64-bit double-precision floating-point number. Its magnitude + * is approximately ±10±300 and it has 16 + * significant digits of precision. + * + * Generated from protobuf field double double_value = 3; + * @return float + */ + public function getDoubleValue() + { + return $this->readOneof(3); + } + + public function hasDoubleValue() + { + return $this->hasOneof(3); + } + + /** + * A 64-bit double-precision floating-point number. Its magnitude + * is approximately ±10±300 and it has 16 + * significant digits of precision. + * + * Generated from protobuf field double double_value = 3; + * @param float $var + * @return $this + */ + public function setDoubleValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * A variable-length string value. + * + * Generated from protobuf field string string_value = 4; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(4); + } + + public function hasStringValue() + { + return $this->hasOneof(4); + } + + /** + * A variable-length string value. + * + * Generated from protobuf field string string_value = 4; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A distribution value. + * + * Generated from protobuf field .google.api.Distribution distribution_value = 5; + * @return \Google\Api\Distribution|null + */ + public function getDistributionValue() + { + return $this->readOneof(5); + } + + public function hasDistributionValue() + { + return $this->hasOneof(5); + } + + /** + * A distribution value. + * + * Generated from protobuf field .google.api.Distribution distribution_value = 5; + * @param \Google\Api\Distribution $var + * @return $this + */ + public function setDistributionValue($var) + { + GPBUtil::checkMessage($var, \Google\Api\Distribution::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateAlertPolicyRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateAlertPolicyRequest.php new file mode 100644 index 000000000000..4891765d0252 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateAlertPolicyRequest.php @@ -0,0 +1,239 @@ +google.monitoring.v3.UpdateAlertPolicyRequest + */ +class UpdateAlertPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $alert_policy = null; + + /** + * @param \Google\Protobuf\FieldMask $updateMask Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * @param \Google\Cloud\Monitoring\V3\AlertPolicy $alertPolicy Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * + * @return \Google\Cloud\Monitoring\V3\UpdateAlertPolicyRequest + * + * @experimental + */ + public static function build(\Google\Protobuf\FieldMask $updateMask, \Google\Cloud\Monitoring\V3\AlertPolicy $alertPolicy): self + { + return (new self()) + ->setUpdateMask($updateMask) + ->setAlertPolicy($alertPolicy); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * @type \Google\Cloud\Monitoring\V3\AlertPolicy $alert_policy + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\AlertService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\AlertPolicy|null + */ + public function getAlertPolicy() + { + return $this->alert_policy; + } + + public function hasAlertPolicy() + { + return isset($this->alert_policy); + } + + public function clearAlertPolicy() + { + unset($this->alert_policy); + } + + /** + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * + * Generated from protobuf field .google.monitoring.v3.AlertPolicy alert_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\AlertPolicy $var + * @return $this + */ + public function setAlertPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy::class); + $this->alert_policy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateGroupRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateGroupRequest.php new file mode 100644 index 000000000000..1acaca5a69df --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateGroupRequest.php @@ -0,0 +1,134 @@ +google.monitoring.v3.UpdateGroupRequest + */ +class UpdateGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group = null; + /** + * If true, validate this request but do not update the existing group. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Monitoring\V3\Group $group Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * + * @return \Google\Cloud\Monitoring\V3\UpdateGroupRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Monitoring\V3\Group $group): self + { + return (new self()) + ->setGroup($group); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\Group $group + * Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * @type bool $validate_only + * If true, validate this request but do not update the existing group. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\GroupService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Group|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * + * Generated from protobuf field .google.monitoring.v3.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Group $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Group::class); + $this->group = $var; + + return $this; + } + + /** + * If true, validate this request but do not update the existing group. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If true, validate this request but do not update the existing group. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateNotificationChannelRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateNotificationChannelRequest.php new file mode 100644 index 000000000000..d66db070896e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateNotificationChannelRequest.php @@ -0,0 +1,151 @@ +google.monitoring.v3.UpdateNotificationChannelRequest + */ +class UpdateNotificationChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $notification_channel = null; + + /** + * @param \Google\Protobuf\FieldMask $updateMask Optional. The fields to update. + * @param \Google\Cloud\Monitoring\V3\NotificationChannel $notificationChannel Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * + * @return \Google\Cloud\Monitoring\V3\UpdateNotificationChannelRequest + * + * @experimental + */ + public static function build(\Google\Protobuf\FieldMask $updateMask, \Google\Cloud\Monitoring\V3\NotificationChannel $notificationChannel): self + { + return (new self()) + ->setUpdateMask($updateMask) + ->setNotificationChannel($notificationChannel); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The fields to update. + * @type \Google\Cloud\Monitoring\V3\NotificationChannel $notification_channel + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. The fields to update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\NotificationChannel|null + */ + public function getNotificationChannel() + { + return $this->notification_channel; + } + + public function hasNotificationChannel() + { + return isset($this->notification_channel); + } + + public function clearNotificationChannel() + { + unset($this->notification_channel); + } + + /** + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * + * Generated from protobuf field .google.monitoring.v3.NotificationChannel notification_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\NotificationChannel $var + * @return $this + */ + public function setNotificationChannel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\NotificationChannel::class); + $this->notification_channel = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceLevelObjectiveRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceLevelObjectiveRequest.php new file mode 100644 index 000000000000..c6521c3f2a33 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceLevelObjectiveRequest.php @@ -0,0 +1,139 @@ +google.monitoring.v3.UpdateServiceLevelObjectiveRequest + */ +class UpdateServiceLevelObjectiveRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_level_objective = null; + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Monitoring\V3\ServiceLevelObjective $serviceLevelObjective Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * + * @return \Google\Cloud\Monitoring\V3\UpdateServiceLevelObjectiveRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Monitoring\V3\ServiceLevelObjective $serviceLevelObjective): self + { + return (new self()) + ->setServiceLevelObjective($serviceLevelObjective); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\ServiceLevelObjective $service_level_objective + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * @type \Google\Protobuf\FieldMask $update_mask + * A set of field paths defining which fields to use for the update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\ServiceLevelObjective|null + */ + public function getServiceLevelObjective() + { + return $this->service_level_objective; + } + + public function hasServiceLevelObjective() + { + return isset($this->service_level_objective); + } + + public function clearServiceLevelObjective() + { + unset($this->service_level_objective); + } + + /** + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.ServiceLevelObjective service_level_objective = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\ServiceLevelObjective $var + * @return $this + */ + public function setServiceLevelObjective($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\ServiceLevelObjective::class); + $this->service_level_objective = $var; + + return $this; + } + + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceRequest.php new file mode 100644 index 000000000000..c672ae081a8d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateServiceRequest.php @@ -0,0 +1,139 @@ +google.monitoring.v3.UpdateServiceRequest + */ +class UpdateServiceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service = null; + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Monitoring\V3\Service $service Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * + * @return \Google\Cloud\Monitoring\V3\UpdateServiceRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Monitoring\V3\Service $service): self + { + return (new self()) + ->setService($service); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\Service $service + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * @type \Google\Protobuf\FieldMask $update_mask + * A set of field paths defining which fields to use for the update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\ServiceService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Service|null + */ + public function getService() + { + return $this->service; + } + + public function hasService() + { + return isset($this->service); + } + + public function clearService() + { + unset($this->service); + } + + /** + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * + * Generated from protobuf field .google.monitoring.v3.Service service = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Service $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Service::class); + $this->service = $var; + + return $this; + } + + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * A set of field paths defining which fields to use for the update. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateSnoozeRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateSnoozeRequest.php new file mode 100644 index 000000000000..d3091d8bda9b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateSnoozeRequest.php @@ -0,0 +1,227 @@ +google.monitoring.v3.UpdateSnoozeRequest + */ +class UpdateSnoozeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Snooze` to update. Must have the name field present. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $snooze = null; + /** + * Required. The fields to update. + * For each field listed in `update_mask`: + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * Fields not listed retain their existing value. + * The following are the field names that are accepted in `update_mask`: + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Monitoring\V3\Snooze $snooze Required. The `Snooze` to update. Must have the name field present. + * @param \Google\Protobuf\FieldMask $updateMask Required. The fields to update. + * + * For each field listed in `update_mask`: + * + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * + * Fields not listed retain their existing value. + * + * The following are the field names that are accepted in `update_mask`: + * + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * + * @return \Google\Cloud\Monitoring\V3\UpdateSnoozeRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Monitoring\V3\Snooze $snooze, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSnooze($snooze) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\Snooze $snooze + * Required. The `Snooze` to update. Must have the name field present. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The fields to update. + * For each field listed in `update_mask`: + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * Fields not listed retain their existing value. + * The following are the field names that are accepted in `update_mask`: + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\SnoozeService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Snooze` to update. Must have the name field present. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\Snooze|null + */ + public function getSnooze() + { + return $this->snooze; + } + + public function hasSnooze() + { + return isset($this->snooze); + } + + public function clearSnooze() + { + unset($this->snooze); + } + + /** + * Required. The `Snooze` to update. Must have the name field present. + * + * Generated from protobuf field .google.monitoring.v3.Snooze snooze = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\Snooze $var + * @return $this + */ + public function setSnooze($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Snooze::class); + $this->snooze = $var; + + return $this; + } + + /** + * Required. The fields to update. + * For each field listed in `update_mask`: + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * Fields not listed retain their existing value. + * The following are the field names that are accepted in `update_mask`: + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The fields to update. + * For each field listed in `update_mask`: + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * Fields not listed retain their existing value. + * The following are the field names that are accepted in `update_mask`: + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateUptimeCheckConfigRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateUptimeCheckConfigRequest.php new file mode 100644 index 000000000000..151f44869152 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UpdateUptimeCheckConfigRequest.php @@ -0,0 +1,192 @@ +google.monitoring.v3.UpdateUptimeCheckConfigRequest + */ +class UpdateUptimeCheckConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + /** + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uptime_check_config = null; + + /** + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptimeCheckConfig Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * + * @return \Google\Cloud\Monitoring\V3\UpdateUptimeCheckConfigRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptimeCheckConfig): self + { + return (new self()) + ->setUptimeCheckConfig($uptimeCheckConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig $uptime_check_config + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\UptimeService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig|null + */ + public function getUptimeCheckConfig() + { + return $this->uptime_check_config; + } + + public function hasUptimeCheckConfig() + { + return isset($this->uptime_check_config); + } + + public function clearUptimeCheckConfig() + { + unset($this->uptime_check_config); + } + + /** + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig uptime_check_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig $var + * @return $this + */ + public function setUptimeCheckConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig::class); + $this->uptime_check_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig.php new file mode 100644 index 000000000000..8823604b32cb --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig.php @@ -0,0 +1,748 @@ +google.monitoring.v3.UptimeCheckConfig + */ +class UptimeCheckConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. A unique resource name for this Uptime check configuration. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the + * Uptime check. + * This field should be omitted when creating the Uptime check configuration; + * on create, the resource name is assigned by the server and included in the + * response. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * A human-friendly name for the Uptime check configuration. The display name + * should be unique within a Cloud Monitoring Workspace in order to make it + * easier to identify; however, uniqueness is not enforced. Required. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * How often, in seconds, the Uptime check is performed. + * Currently, the only supported values are `60s` (1 minute), `300s` + * (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, + * defaults to `60s`. + * + * Generated from protobuf field .google.protobuf.Duration period = 7; + */ + protected $period = null; + /** + * The maximum amount of time to wait for the request to complete (must be + * between 1 and 60 seconds). Required. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + */ + protected $timeout = null; + /** + * The content that is expected to appear in the data returned by the target + * server against which the check is run. Currently, only the first entry + * in the `content_matchers` list is supported, and additional entries will + * be ignored. This field is optional and should only be specified if a + * content match is required as part of the/ Uptime check. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.ContentMatcher content_matchers = 9; + */ + private $content_matchers; + /** + * The type of checkers to use to execute the Uptime check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.CheckerType checker_type = 17; + */ + protected $checker_type = 0; + /** + * The list of regions from which the check will be run. + * Some regions contain one location, and others contain more than one. + * If this field is specified, enough regions must be provided to include a + * minimum of 3 locations. Not specifying this field will result in Uptime + * checks running from all available regions. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckRegion selected_regions = 10; + */ + private $selected_regions; + /** + * If this is `true`, then checks are made only from the 'internal_checkers'. + * If it is `false`, then checks are made only from the 'selected_regions'. + * It is an error to provide 'selected_regions' when is_internal is `true`, + * or to provide 'internal_checkers' when is_internal is `false`. + * + * Generated from protobuf field bool is_internal = 15 [deprecated = true]; + * @deprecated + */ + protected $is_internal = false; + /** + * The internal checkers that this check will egress from. If `is_internal` is + * `true` and this list is empty, the check will egress from all the + * InternalCheckers configured for the project that owns this + * `UptimeCheckConfig`. + * + * Generated from protobuf field repeated .google.monitoring.v3.InternalChecker internal_checkers = 14 [deprecated = true]; + * @deprecated + */ + private $internal_checkers; + /** + * User-supplied key/value data to be used for organizing and + * identifying the `UptimeCheckConfig` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 20; + */ + private $user_labels; + protected $resource; + protected $check_request_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. A unique resource name for this Uptime check configuration. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the + * Uptime check. + * This field should be omitted when creating the Uptime check configuration; + * on create, the resource name is assigned by the server and included in the + * response. + * @type string $display_name + * A human-friendly name for the Uptime check configuration. The display name + * should be unique within a Cloud Monitoring Workspace in order to make it + * easier to identify; however, uniqueness is not enforced. Required. + * @type \Google\Api\MonitoredResource $monitored_resource + * The [monitored + * resource](https://cloud.google.com/monitoring/api/resources) associated + * with the configuration. + * The following monitored resource types are valid for this field: + * `uptime_url`, + * `gce_instance`, + * `gae_app`, + * `aws_ec2_instance`, + * `aws_elb_load_balancer` + * `k8s_service` + * `servicedirectory_service` + * `cloud_run_revision` + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ResourceGroup $resource_group + * The group resource associated with the configuration. + * @type \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget $synthetic_monitor + * Specifies a Synthetic Monitor to invoke. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck $http_check + * Contains information needed to make an HTTP or HTTPS check. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\TcpCheck $tcp_check + * Contains information needed to make a TCP check. + * @type \Google\Protobuf\Duration $period + * How often, in seconds, the Uptime check is performed. + * Currently, the only supported values are `60s` (1 minute), `300s` + * (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, + * defaults to `60s`. + * @type \Google\Protobuf\Duration $timeout + * The maximum amount of time to wait for the request to complete (must be + * between 1 and 60 seconds). Required. + * @type array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher>|\Google\Protobuf\Internal\RepeatedField $content_matchers + * The content that is expected to appear in the data returned by the target + * server against which the check is run. Currently, only the first entry + * in the `content_matchers` list is supported, and additional entries will + * be ignored. This field is optional and should only be specified if a + * content match is required as part of the/ Uptime check. + * @type int $checker_type + * The type of checkers to use to execute the Uptime check. + * @type array|\Google\Protobuf\Internal\RepeatedField $selected_regions + * The list of regions from which the check will be run. + * Some regions contain one location, and others contain more than one. + * If this field is specified, enough regions must be provided to include a + * minimum of 3 locations. Not specifying this field will result in Uptime + * checks running from all available regions. + * @type bool $is_internal + * If this is `true`, then checks are made only from the 'internal_checkers'. + * If it is `false`, then checks are made only from the 'selected_regions'. + * It is an error to provide 'selected_regions' when is_internal is `true`, + * or to provide 'internal_checkers' when is_internal is `false`. + * @type array<\Google\Cloud\Monitoring\V3\InternalChecker>|\Google\Protobuf\Internal\RepeatedField $internal_checkers + * The internal checkers that this check will egress from. If `is_internal` is + * `true` and this list is empty, the check will egress from all the + * InternalCheckers configured for the project that owns this + * `UptimeCheckConfig`. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * User-supplied key/value data to be used for organizing and + * identifying the `UptimeCheckConfig` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. A unique resource name for this Uptime check configuration. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the + * Uptime check. + * This field should be omitted when creating the Uptime check configuration; + * on create, the resource name is assigned by the server and included in the + * response. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. A unique resource name for this Uptime check configuration. The + * format is: + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the + * Uptime check. + * This field should be omitted when creating the Uptime check configuration; + * on create, the resource name is assigned by the server and included in the + * response. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A human-friendly name for the Uptime check configuration. The display name + * should be unique within a Cloud Monitoring Workspace in order to make it + * easier to identify; however, uniqueness is not enforced. Required. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A human-friendly name for the Uptime check configuration. The display name + * should be unique within a Cloud Monitoring Workspace in order to make it + * easier to identify; however, uniqueness is not enforced. Required. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The [monitored + * resource](https://cloud.google.com/monitoring/api/resources) associated + * with the configuration. + * The following monitored resource types are valid for this field: + * `uptime_url`, + * `gce_instance`, + * `gae_app`, + * `aws_ec2_instance`, + * `aws_elb_load_balancer` + * `k8s_service` + * `servicedirectory_service` + * `cloud_run_revision` + * + * Generated from protobuf field .google.api.MonitoredResource monitored_resource = 3; + * @return \Google\Api\MonitoredResource|null + */ + public function getMonitoredResource() + { + return $this->readOneof(3); + } + + public function hasMonitoredResource() + { + return $this->hasOneof(3); + } + + /** + * The [monitored + * resource](https://cloud.google.com/monitoring/api/resources) associated + * with the configuration. + * The following monitored resource types are valid for this field: + * `uptime_url`, + * `gce_instance`, + * `gae_app`, + * `aws_ec2_instance`, + * `aws_elb_load_balancer` + * `k8s_service` + * `servicedirectory_service` + * `cloud_run_revision` + * + * Generated from protobuf field .google.api.MonitoredResource monitored_resource = 3; + * @param \Google\Api\MonitoredResource $var + * @return $this + */ + public function setMonitoredResource($var) + { + GPBUtil::checkMessage($var, \Google\Api\MonitoredResource::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The group resource associated with the configuration. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ResourceGroup resource_group = 4; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ResourceGroup|null + */ + public function getResourceGroup() + { + return $this->readOneof(4); + } + + public function hasResourceGroup() + { + return $this->hasOneof(4); + } + + /** + * The group resource associated with the configuration. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ResourceGroup resource_group = 4; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ResourceGroup $var + * @return $this + */ + public function setResourceGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ResourceGroup::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Specifies a Synthetic Monitor to invoke. + * + * Generated from protobuf field .google.monitoring.v3.SyntheticMonitorTarget synthetic_monitor = 21; + * @return \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget|null + */ + public function getSyntheticMonitor() + { + return $this->readOneof(21); + } + + public function hasSyntheticMonitor() + { + return $this->hasOneof(21); + } + + /** + * Specifies a Synthetic Monitor to invoke. + * + * Generated from protobuf field .google.monitoring.v3.SyntheticMonitorTarget synthetic_monitor = 21; + * @param \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget $var + * @return $this + */ + public function setSyntheticMonitor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\SyntheticMonitorTarget::class); + $this->writeOneof(21, $var); + + return $this; + } + + /** + * Contains information needed to make an HTTP or HTTPS check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck http_check = 5; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck|null + */ + public function getHttpCheck() + { + return $this->readOneof(5); + } + + public function hasHttpCheck() + { + return $this->hasOneof(5); + } + + /** + * Contains information needed to make an HTTP or HTTPS check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck http_check = 5; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck $var + * @return $this + */ + public function setHttpCheck($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Contains information needed to make a TCP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.TcpCheck tcp_check = 6; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\TcpCheck|null + */ + public function getTcpCheck() + { + return $this->readOneof(6); + } + + public function hasTcpCheck() + { + return $this->hasOneof(6); + } + + /** + * Contains information needed to make a TCP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.TcpCheck tcp_check = 6; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\TcpCheck $var + * @return $this + */ + public function setTcpCheck($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\TcpCheck::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * How often, in seconds, the Uptime check is performed. + * Currently, the only supported values are `60s` (1 minute), `300s` + * (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, + * defaults to `60s`. + * + * Generated from protobuf field .google.protobuf.Duration period = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getPeriod() + { + return $this->period; + } + + public function hasPeriod() + { + return isset($this->period); + } + + public function clearPeriod() + { + unset($this->period); + } + + /** + * How often, in seconds, the Uptime check is performed. + * Currently, the only supported values are `60s` (1 minute), `300s` + * (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, + * defaults to `60s`. + * + * Generated from protobuf field .google.protobuf.Duration period = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->period = $var; + + return $this; + } + + /** + * The maximum amount of time to wait for the request to complete (must be + * between 1 and 60 seconds). Required. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeout() + { + return $this->timeout; + } + + public function hasTimeout() + { + return isset($this->timeout); + } + + public function clearTimeout() + { + unset($this->timeout); + } + + /** + * The maximum amount of time to wait for the request to complete (must be + * between 1 and 60 seconds). Required. + * + * Generated from protobuf field .google.protobuf.Duration timeout = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->timeout = $var; + + return $this; + } + + /** + * The content that is expected to appear in the data returned by the target + * server against which the check is run. Currently, only the first entry + * in the `content_matchers` list is supported, and additional entries will + * be ignored. This field is optional and should only be specified if a + * content match is required as part of the/ Uptime check. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.ContentMatcher content_matchers = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContentMatchers() + { + return $this->content_matchers; + } + + /** + * The content that is expected to appear in the data returned by the target + * server against which the check is run. Currently, only the first entry + * in the `content_matchers` list is supported, and additional entries will + * be ignored. This field is optional and should only be specified if a + * content match is required as part of the/ Uptime check. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.ContentMatcher content_matchers = 9; + * @param array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContentMatchers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher::class); + $this->content_matchers = $arr; + + return $this; + } + + /** + * The type of checkers to use to execute the Uptime check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.CheckerType checker_type = 17; + * @return int + */ + public function getCheckerType() + { + return $this->checker_type; + } + + /** + * The type of checkers to use to execute the Uptime check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.CheckerType checker_type = 17; + * @param int $var + * @return $this + */ + public function setCheckerType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\CheckerType::class); + $this->checker_type = $var; + + return $this; + } + + /** + * The list of regions from which the check will be run. + * Some regions contain one location, and others contain more than one. + * If this field is specified, enough regions must be provided to include a + * minimum of 3 locations. Not specifying this field will result in Uptime + * checks running from all available regions. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckRegion selected_regions = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSelectedRegions() + { + return $this->selected_regions; + } + + /** + * The list of regions from which the check will be run. + * Some regions contain one location, and others contain more than one. + * If this field is specified, enough regions must be provided to include a + * minimum of 3 locations. Not specifying this field will result in Uptime + * checks running from all available regions. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckRegion selected_regions = 10; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSelectedRegions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Monitoring\V3\UptimeCheckRegion::class); + $this->selected_regions = $arr; + + return $this; + } + + /** + * If this is `true`, then checks are made only from the 'internal_checkers'. + * If it is `false`, then checks are made only from the 'selected_regions'. + * It is an error to provide 'selected_regions' when is_internal is `true`, + * or to provide 'internal_checkers' when is_internal is `false`. + * + * Generated from protobuf field bool is_internal = 15 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getIsInternal() + { + @trigger_error('is_internal is deprecated.', E_USER_DEPRECATED); + return $this->is_internal; + } + + /** + * If this is `true`, then checks are made only from the 'internal_checkers'. + * If it is `false`, then checks are made only from the 'selected_regions'. + * It is an error to provide 'selected_regions' when is_internal is `true`, + * or to provide 'internal_checkers' when is_internal is `false`. + * + * Generated from protobuf field bool is_internal = 15 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setIsInternal($var) + { + @trigger_error('is_internal is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->is_internal = $var; + + return $this; + } + + /** + * The internal checkers that this check will egress from. If `is_internal` is + * `true` and this list is empty, the check will egress from all the + * InternalCheckers configured for the project that owns this + * `UptimeCheckConfig`. + * + * Generated from protobuf field repeated .google.monitoring.v3.InternalChecker internal_checkers = 14 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getInternalCheckers() + { + @trigger_error('internal_checkers is deprecated.', E_USER_DEPRECATED); + return $this->internal_checkers; + } + + /** + * The internal checkers that this check will egress from. If `is_internal` is + * `true` and this list is empty, the check will egress from all the + * InternalCheckers configured for the project that owns this + * `UptimeCheckConfig`. + * + * Generated from protobuf field repeated .google.monitoring.v3.InternalChecker internal_checkers = 14 [deprecated = true]; + * @param array<\Google\Cloud\Monitoring\V3\InternalChecker>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setInternalCheckers($var) + { + @trigger_error('internal_checkers is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\InternalChecker::class); + $this->internal_checkers = $arr; + + return $this; + } + + /** + * User-supplied key/value data to be used for organizing and + * identifying the `UptimeCheckConfig` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 20; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * User-supplied key/value data to be used for organizing and + * identifying the `UptimeCheckConfig` objects. + * The field can contain up to 64 entries. Each key and value is limited to + * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + * values can contain only lowercase letters, numerals, underscores, and + * dashes. Keys must begin with a letter. + * + * Generated from protobuf field map user_labels = 20; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getResource() + { + return $this->whichOneof("resource"); + } + + /** + * @return string + */ + public function getCheckRequestType() + { + return $this->whichOneof("check_request_type"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/CheckerType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/CheckerType.php new file mode 100644 index 000000000000..e97a33453e22 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/CheckerType.php @@ -0,0 +1,69 @@ +google.monitoring.v3.UptimeCheckConfig.CheckerType + */ +class CheckerType +{ + /** + * The default checker type. Currently converted to `STATIC_IP_CHECKERS` + * on creation, the default conversion behavior may change in the future. + * + * Generated from protobuf enum CHECKER_TYPE_UNSPECIFIED = 0; + */ + const CHECKER_TYPE_UNSPECIFIED = 0; + /** + * `STATIC_IP_CHECKERS` are used for uptime checks that perform egress + * across the public internet. `STATIC_IP_CHECKERS` use the static IP + * addresses returned by `ListUptimeCheckIps`. + * + * Generated from protobuf enum STATIC_IP_CHECKERS = 1; + */ + const STATIC_IP_CHECKERS = 1; + /** + * `VPC_CHECKERS` are used for uptime checks that perform egress using + * Service Directory and private network access. When using `VPC_CHECKERS`, + * the monitored resource type must be `servicedirectory_service`. + * + * Generated from protobuf enum VPC_CHECKERS = 3; + */ + const VPC_CHECKERS = 3; + + private static $valueToName = [ + self::CHECKER_TYPE_UNSPECIFIED => 'CHECKER_TYPE_UNSPECIFIED', + self::STATIC_IP_CHECKERS => 'STATIC_IP_CHECKERS', + self::VPC_CHECKERS => 'VPC_CHECKERS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CheckerType::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_CheckerType::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher.php new file mode 100644 index 000000000000..6c5646dbef86 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher.php @@ -0,0 +1,158 @@ +google.monitoring.v3.UptimeCheckConfig.ContentMatcher + */ +class ContentMatcher extends \Google\Protobuf\Internal\Message +{ + /** + * String, regex or JSON content to match. Maximum 1024 bytes. An empty + * `content` string indicates no content matching is to be performed. + * + * Generated from protobuf field string content = 1; + */ + protected $content = ''; + /** + * The type of content matcher that will be applied to the server output, + * compared to the `content` string when the check is run. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption matcher = 2; + */ + protected $matcher = 0; + protected $additional_matcher_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * String, regex or JSON content to match. Maximum 1024 bytes. An empty + * `content` string indicates no content matching is to be performed. + * @type int $matcher + * The type of content matcher that will be applied to the server output, + * compared to the `content` string when the check is run. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\JsonPathMatcher $json_path_matcher + * Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * String, regex or JSON content to match. Maximum 1024 bytes. An empty + * `content` string indicates no content matching is to be performed. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * String, regex or JSON content to match. Maximum 1024 bytes. An empty + * `content` string indicates no content matching is to be performed. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * The type of content matcher that will be applied to the server output, + * compared to the `content` string when the check is run. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption matcher = 2; + * @return int + */ + public function getMatcher() + { + return $this->matcher; + } + + /** + * The type of content matcher that will be applied to the server output, + * compared to the `content` string when the check is run. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption matcher = 2; + * @param int $var + * @return $this + */ + public function setMatcher($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\ContentMatcherOption::class); + $this->matcher = $var; + + return $this; + } + + /** + * Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH` + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher json_path_matcher = 3; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\JsonPathMatcher|null + */ + public function getJsonPathMatcher() + { + return $this->readOneof(3); + } + + public function hasJsonPathMatcher() + { + return $this->hasOneof(3); + } + + /** + * Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH` + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher json_path_matcher = 3; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\JsonPathMatcher $var + * @return $this + */ + public function setJsonPathMatcher($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\JsonPathMatcher::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getAdditionalMatcherInfo() + { + return $this->whichOneof("additional_matcher_info"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContentMatcher::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_ContentMatcher::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/ContentMatcherOption.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/ContentMatcherOption.php new file mode 100644 index 000000000000..3dffeaa7586f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/ContentMatcherOption.php @@ -0,0 +1,107 @@ +google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption + */ +class ContentMatcherOption +{ + /** + * No content matcher type specified (maintained for backward + * compatibility, but deprecated for future use). + * Treated as `CONTAINS_STRING`. + * + * Generated from protobuf enum CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; + */ + const CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; + /** + * Selects substring matching. The match succeeds if the output contains + * the `content` string. This is the default value for checks without + * a `matcher` option, or where the value of `matcher` is + * `CONTENT_MATCHER_OPTION_UNSPECIFIED`. + * + * Generated from protobuf enum CONTAINS_STRING = 1; + */ + const CONTAINS_STRING = 1; + /** + * Selects negation of substring matching. The match succeeds if the + * output does _NOT_ contain the `content` string. + * + * Generated from protobuf enum NOT_CONTAINS_STRING = 2; + */ + const NOT_CONTAINS_STRING = 2; + /** + * Selects regular-expression matching. The match succeeds if the output + * matches the regular expression specified in the `content` string. + * Regex matching is only supported for HTTP/HTTPS checks. + * + * Generated from protobuf enum MATCHES_REGEX = 3; + */ + const MATCHES_REGEX = 3; + /** + * Selects negation of regular-expression matching. The match succeeds if + * the output does _NOT_ match the regular expression specified in the + * `content` string. Regex matching is only supported for HTTP/HTTPS + * checks. + * + * Generated from protobuf enum NOT_MATCHES_REGEX = 4; + */ + const NOT_MATCHES_REGEX = 4; + /** + * Selects JSONPath matching. See `JsonPathMatcher` for details on when + * the match succeeds. JSONPath matching is only supported for HTTP/HTTPS + * checks. + * + * Generated from protobuf enum MATCHES_JSON_PATH = 5; + */ + const MATCHES_JSON_PATH = 5; + /** + * Selects JSONPath matching. See `JsonPathMatcher` for details on when + * the match succeeds. Succeeds when output does _NOT_ match as specified. + * JSONPath is only supported for HTTP/HTTPS checks. + * + * Generated from protobuf enum NOT_MATCHES_JSON_PATH = 6; + */ + const NOT_MATCHES_JSON_PATH = 6; + + private static $valueToName = [ + self::CONTENT_MATCHER_OPTION_UNSPECIFIED => 'CONTENT_MATCHER_OPTION_UNSPECIFIED', + self::CONTAINS_STRING => 'CONTAINS_STRING', + self::NOT_CONTAINS_STRING => 'NOT_CONTAINS_STRING', + self::MATCHES_REGEX => 'MATCHES_REGEX', + self::NOT_MATCHES_REGEX => 'NOT_MATCHES_REGEX', + self::MATCHES_JSON_PATH => 'MATCHES_JSON_PATH', + self::NOT_MATCHES_JSON_PATH => 'NOT_MATCHES_JSON_PATH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContentMatcherOption::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_ContentMatcher_ContentMatcherOption::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher.php new file mode 100644 index 000000000000..04e6f363bfab --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher.php @@ -0,0 +1,114 @@ +google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher + */ +class JsonPathMatcher extends \Google\Protobuf\Internal\Message +{ + /** + * JSONPath within the response output pointing to the expected + * `ContentMatcher::content` to match against. + * + * Generated from protobuf field string json_path = 1; + */ + protected $json_path = ''; + /** + * The type of JSONPath match that will be applied to the JSON output + * (`ContentMatcher.content`) + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption json_matcher = 2; + */ + protected $json_matcher = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $json_path + * JSONPath within the response output pointing to the expected + * `ContentMatcher::content` to match against. + * @type int $json_matcher + * The type of JSONPath match that will be applied to the JSON output + * (`ContentMatcher.content`) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * JSONPath within the response output pointing to the expected + * `ContentMatcher::content` to match against. + * + * Generated from protobuf field string json_path = 1; + * @return string + */ + public function getJsonPath() + { + return $this->json_path; + } + + /** + * JSONPath within the response output pointing to the expected + * `ContentMatcher::content` to match against. + * + * Generated from protobuf field string json_path = 1; + * @param string $var + * @return $this + */ + public function setJsonPath($var) + { + GPBUtil::checkString($var, True); + $this->json_path = $var; + + return $this; + } + + /** + * The type of JSONPath match that will be applied to the JSON output + * (`ContentMatcher.content`) + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption json_matcher = 2; + * @return int + */ + public function getJsonMatcher() + { + return $this->json_matcher; + } + + /** + * The type of JSONPath match that will be applied to the JSON output + * (`ContentMatcher.content`) + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption json_matcher = 2; + * @param int $var + * @return $this + */ + public function setJsonMatcher($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\ContentMatcher\JsonPathMatcher\JsonPathMatcherOption::class); + $this->json_matcher = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JsonPathMatcher::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_ContentMatcher_JsonPathMatcher::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher/JsonPathMatcherOption.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher/JsonPathMatcherOption.php new file mode 100644 index 000000000000..965725688ee1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ContentMatcher/JsonPathMatcher/JsonPathMatcherOption.php @@ -0,0 +1,68 @@ +google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption + */ +class JsonPathMatcherOption +{ + /** + * No JSONPath matcher type specified (not valid). + * + * Generated from protobuf enum JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0; + */ + const JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0; + /** + * Selects 'exact string' matching. The match succeeds if the content at + * the `json_path` within the output is exactly the same as the + * `content` string. + * + * Generated from protobuf enum EXACT_MATCH = 1; + */ + const EXACT_MATCH = 1; + /** + * Selects regular-expression matching. The match succeeds if the + * content at the `json_path` within the output matches the regular + * expression specified in the `content` string. + * + * Generated from protobuf enum REGEX_MATCH = 2; + */ + const REGEX_MATCH = 2; + + private static $valueToName = [ + self::JSON_PATH_MATCHER_OPTION_UNSPECIFIED => 'JSON_PATH_MATCHER_OPTION_UNSPECIFIED', + self::EXACT_MATCH => 'EXACT_MATCH', + self::REGEX_MATCH => 'REGEX_MATCH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JsonPathMatcherOption::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_ContentMatcher_JsonPathMatcher_JsonPathMatcherOption::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck.php new file mode 100644 index 000000000000..0c3ff2d2ed8d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck.php @@ -0,0 +1,730 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck + */ +class HttpCheck extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP request method to use for the check. If set to + * `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod request_method = 8; + */ + protected $request_method = 0; + /** + * If `true`, use HTTPS instead of HTTP to run the check. + * + * Generated from protobuf field bool use_ssl = 1; + */ + protected $use_ssl = false; + /** + * Optional (defaults to "/"). The path to the page against which to run + * the check. Will be combined with the `host` (specified within the + * `monitored_resource`) and `port` to construct the full URL. If the + * provided path does not begin with "/", a "/" will be prepended + * automatically. + * + * Generated from protobuf field string path = 2; + */ + protected $path = ''; + /** + * Optional (defaults to 80 when `use_ssl` is `false`, and 443 when + * `use_ssl` is `true`). The TCP port on the HTTP server against which to + * run the check. Will be combined with host (specified within the + * `monitored_resource`) and `path` to construct the full URL. + * + * Generated from protobuf field int32 port = 3; + */ + protected $port = 0; + /** + * The authentication information. Optional when creating an HTTP check; + * defaults to empty. + * Do not set both `auth_method` and `auth_info`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication auth_info = 4; + */ + protected $auth_info = null; + /** + * Boolean specifying whether to encrypt the header information. + * Encryption should be specified for any headers related to authentication + * that you do not wish to be seen when retrieving the configuration. The + * server will be responsible for encrypting the headers. + * On Get/List calls, if `mask_headers` is set to `true` then the headers + * will be obscured with `******.` + * + * Generated from protobuf field bool mask_headers = 5; + */ + protected $mask_headers = false; + /** + * The list of headers to send as part of the Uptime check request. + * If two headers have the same key and different values, they should + * be entered as a single header, with the value being a comma-separated + * list of all the desired values as described at + * https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). + * Entering two separate headers with the same key in a Create call will + * cause the first to be overwritten by the second. + * The maximum number of headers allowed is 100. + * + * Generated from protobuf field map headers = 6; + */ + private $headers; + /** + * The content type header to use for the check. The following + * configurations result in errors: + * 1. Content type is specified in both the `headers` field and the + * `content_type` field. + * 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` + * 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. + * 4. Request method is `POST` and a "Content-Type" header is provided via + * `headers` field. The `content_type` field should be used instead. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType content_type = 9; + */ + protected $content_type = 0; + /** + * A user provided content type header to use for the check. The invalid + * configurations outlined in the `content_type` field apply to + * `custom_content_type`, as well as the following: + * 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set. + * 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not + * set. + * + * Generated from protobuf field string custom_content_type = 13; + */ + protected $custom_content_type = ''; + /** + * Boolean specifying whether to include SSL certificate validation as a + * part of the Uptime check. Only applies to checks where + * `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, + * setting `validate_ssl` to `true` has no effect. + * + * Generated from protobuf field bool validate_ssl = 7; + */ + protected $validate_ssl = false; + /** + * The request body associated with the HTTP POST request. If `content_type` + * is `URL_ENCODED`, the body passed in must be URL-encoded. Users can + * provide a `Content-Length` header via the `headers` field or the API will + * do so. If the `request_method` is `GET` and `body` is not empty, the API + * will return an error. The maximum byte size is 1 megabyte. + * Note: If client libraries aren't used (which performs the conversion + * automatically) base64 encode your `body` data since the field is of + * `bytes` type. + * + * Generated from protobuf field bytes body = 10; + */ + protected $body = ''; + /** + * If present, the check will only pass if the HTTP response status code is + * in this set of status codes. If empty, the HTTP status code will only + * pass if the HTTP status code is 200-299. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode accepted_response_status_codes = 11; + */ + private $accepted_response_status_codes; + /** + * Contains information needed to add pings to an HTTP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 12; + */ + protected $ping_config = null; + protected $auth_method; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $request_method + * The HTTP request method to use for the check. If set to + * `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. + * @type bool $use_ssl + * If `true`, use HTTPS instead of HTTP to run the check. + * @type string $path + * Optional (defaults to "/"). The path to the page against which to run + * the check. Will be combined with the `host` (specified within the + * `monitored_resource`) and `port` to construct the full URL. If the + * provided path does not begin with "/", a "/" will be prepended + * automatically. + * @type int $port + * Optional (defaults to 80 when `use_ssl` is `false`, and 443 when + * `use_ssl` is `true`). The TCP port on the HTTP server against which to + * run the check. Will be combined with host (specified within the + * `monitored_resource`) and `path` to construct the full URL. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\BasicAuthentication $auth_info + * The authentication information. Optional when creating an HTTP check; + * defaults to empty. + * Do not set both `auth_method` and `auth_info`. + * @type bool $mask_headers + * Boolean specifying whether to encrypt the header information. + * Encryption should be specified for any headers related to authentication + * that you do not wish to be seen when retrieving the configuration. The + * server will be responsible for encrypting the headers. + * On Get/List calls, if `mask_headers` is set to `true` then the headers + * will be obscured with `******.` + * @type array|\Google\Protobuf\Internal\MapField $headers + * The list of headers to send as part of the Uptime check request. + * If two headers have the same key and different values, they should + * be entered as a single header, with the value being a comma-separated + * list of all the desired values as described at + * https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). + * Entering two separate headers with the same key in a Create call will + * cause the first to be overwritten by the second. + * The maximum number of headers allowed is 100. + * @type int $content_type + * The content type header to use for the check. The following + * configurations result in errors: + * 1. Content type is specified in both the `headers` field and the + * `content_type` field. + * 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` + * 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. + * 4. Request method is `POST` and a "Content-Type" header is provided via + * `headers` field. The `content_type` field should be used instead. + * @type string $custom_content_type + * A user provided content type header to use for the check. The invalid + * configurations outlined in the `content_type` field apply to + * `custom_content_type`, as well as the following: + * 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set. + * 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not + * set. + * @type bool $validate_ssl + * Boolean specifying whether to include SSL certificate validation as a + * part of the Uptime check. Only applies to checks where + * `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, + * setting `validate_ssl` to `true` has no effect. + * @type string $body + * The request body associated with the HTTP POST request. If `content_type` + * is `URL_ENCODED`, the body passed in must be URL-encoded. Users can + * provide a `Content-Length` header via the `headers` field or the API will + * do so. If the `request_method` is `GET` and `body` is not empty, the API + * will return an error. The maximum byte size is 1 megabyte. + * Note: If client libraries aren't used (which performs the conversion + * automatically) base64 encode your `body` data since the field is of + * `bytes` type. + * @type array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ResponseStatusCode>|\Google\Protobuf\Internal\RepeatedField $accepted_response_status_codes + * If present, the check will only pass if the HTTP response status code is + * in this set of status codes. If empty, the HTTP status code will only + * pass if the HTTP status code is 200-299. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig $ping_config + * Contains information needed to add pings to an HTTP check. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ServiceAgentAuthentication $service_agent_authentication + * If specified, Uptime will generate and attach an OIDC JWT token for the + * Monitoring service agent service account as an `Authorization` header + * in the HTTP request when probing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP request method to use for the check. If set to + * `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod request_method = 8; + * @return int + */ + public function getRequestMethod() + { + return $this->request_method; + } + + /** + * The HTTP request method to use for the check. If set to + * `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod request_method = 8; + * @param int $var + * @return $this + */ + public function setRequestMethod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\RequestMethod::class); + $this->request_method = $var; + + return $this; + } + + /** + * If `true`, use HTTPS instead of HTTP to run the check. + * + * Generated from protobuf field bool use_ssl = 1; + * @return bool + */ + public function getUseSsl() + { + return $this->use_ssl; + } + + /** + * If `true`, use HTTPS instead of HTTP to run the check. + * + * Generated from protobuf field bool use_ssl = 1; + * @param bool $var + * @return $this + */ + public function setUseSsl($var) + { + GPBUtil::checkBool($var); + $this->use_ssl = $var; + + return $this; + } + + /** + * Optional (defaults to "/"). The path to the page against which to run + * the check. Will be combined with the `host` (specified within the + * `monitored_resource`) and `port` to construct the full URL. If the + * provided path does not begin with "/", a "/" will be prepended + * automatically. + * + * Generated from protobuf field string path = 2; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Optional (defaults to "/"). The path to the page against which to run + * the check. Will be combined with the `host` (specified within the + * `monitored_resource`) and `port` to construct the full URL. If the + * provided path does not begin with "/", a "/" will be prepended + * automatically. + * + * Generated from protobuf field string path = 2; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Optional (defaults to 80 when `use_ssl` is `false`, and 443 when + * `use_ssl` is `true`). The TCP port on the HTTP server against which to + * run the check. Will be combined with host (specified within the + * `monitored_resource`) and `path` to construct the full URL. + * + * Generated from protobuf field int32 port = 3; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Optional (defaults to 80 when `use_ssl` is `false`, and 443 when + * `use_ssl` is `true`). The TCP port on the HTTP server against which to + * run the check. Will be combined with host (specified within the + * `monitored_resource`) and `path` to construct the full URL. + * + * Generated from protobuf field int32 port = 3; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * The authentication information. Optional when creating an HTTP check; + * defaults to empty. + * Do not set both `auth_method` and `auth_info`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication auth_info = 4; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\BasicAuthentication|null + */ + public function getAuthInfo() + { + return $this->auth_info; + } + + public function hasAuthInfo() + { + return isset($this->auth_info); + } + + public function clearAuthInfo() + { + unset($this->auth_info); + } + + /** + * The authentication information. Optional when creating an HTTP check; + * defaults to empty. + * Do not set both `auth_method` and `auth_info`. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication auth_info = 4; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\BasicAuthentication $var + * @return $this + */ + public function setAuthInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\BasicAuthentication::class); + $this->auth_info = $var; + + return $this; + } + + /** + * Boolean specifying whether to encrypt the header information. + * Encryption should be specified for any headers related to authentication + * that you do not wish to be seen when retrieving the configuration. The + * server will be responsible for encrypting the headers. + * On Get/List calls, if `mask_headers` is set to `true` then the headers + * will be obscured with `******.` + * + * Generated from protobuf field bool mask_headers = 5; + * @return bool + */ + public function getMaskHeaders() + { + return $this->mask_headers; + } + + /** + * Boolean specifying whether to encrypt the header information. + * Encryption should be specified for any headers related to authentication + * that you do not wish to be seen when retrieving the configuration. The + * server will be responsible for encrypting the headers. + * On Get/List calls, if `mask_headers` is set to `true` then the headers + * will be obscured with `******.` + * + * Generated from protobuf field bool mask_headers = 5; + * @param bool $var + * @return $this + */ + public function setMaskHeaders($var) + { + GPBUtil::checkBool($var); + $this->mask_headers = $var; + + return $this; + } + + /** + * The list of headers to send as part of the Uptime check request. + * If two headers have the same key and different values, they should + * be entered as a single header, with the value being a comma-separated + * list of all the desired values as described at + * https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). + * Entering two separate headers with the same key in a Create call will + * cause the first to be overwritten by the second. + * The maximum number of headers allowed is 100. + * + * Generated from protobuf field map headers = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * The list of headers to send as part of the Uptime check request. + * If two headers have the same key and different values, they should + * be entered as a single header, with the value being a comma-separated + * list of all the desired values as described at + * https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). + * Entering two separate headers with the same key in a Create call will + * cause the first to be overwritten by the second. + * The maximum number of headers allowed is 100. + * + * Generated from protobuf field map headers = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->headers = $arr; + + return $this; + } + + /** + * The content type header to use for the check. The following + * configurations result in errors: + * 1. Content type is specified in both the `headers` field and the + * `content_type` field. + * 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` + * 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. + * 4. Request method is `POST` and a "Content-Type" header is provided via + * `headers` field. The `content_type` field should be used instead. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType content_type = 9; + * @return int + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * The content type header to use for the check. The following + * configurations result in errors: + * 1. Content type is specified in both the `headers` field and the + * `content_type` field. + * 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` + * 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. + * 4. Request method is `POST` and a "Content-Type" header is provided via + * `headers` field. The `content_type` field should be used instead. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType content_type = 9; + * @param int $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ContentType::class); + $this->content_type = $var; + + return $this; + } + + /** + * A user provided content type header to use for the check. The invalid + * configurations outlined in the `content_type` field apply to + * `custom_content_type`, as well as the following: + * 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set. + * 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not + * set. + * + * Generated from protobuf field string custom_content_type = 13; + * @return string + */ + public function getCustomContentType() + { + return $this->custom_content_type; + } + + /** + * A user provided content type header to use for the check. The invalid + * configurations outlined in the `content_type` field apply to + * `custom_content_type`, as well as the following: + * 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set. + * 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not + * set. + * + * Generated from protobuf field string custom_content_type = 13; + * @param string $var + * @return $this + */ + public function setCustomContentType($var) + { + GPBUtil::checkString($var, True); + $this->custom_content_type = $var; + + return $this; + } + + /** + * Boolean specifying whether to include SSL certificate validation as a + * part of the Uptime check. Only applies to checks where + * `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, + * setting `validate_ssl` to `true` has no effect. + * + * Generated from protobuf field bool validate_ssl = 7; + * @return bool + */ + public function getValidateSsl() + { + return $this->validate_ssl; + } + + /** + * Boolean specifying whether to include SSL certificate validation as a + * part of the Uptime check. Only applies to checks where + * `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, + * setting `validate_ssl` to `true` has no effect. + * + * Generated from protobuf field bool validate_ssl = 7; + * @param bool $var + * @return $this + */ + public function setValidateSsl($var) + { + GPBUtil::checkBool($var); + $this->validate_ssl = $var; + + return $this; + } + + /** + * The request body associated with the HTTP POST request. If `content_type` + * is `URL_ENCODED`, the body passed in must be URL-encoded. Users can + * provide a `Content-Length` header via the `headers` field or the API will + * do so. If the `request_method` is `GET` and `body` is not empty, the API + * will return an error. The maximum byte size is 1 megabyte. + * Note: If client libraries aren't used (which performs the conversion + * automatically) base64 encode your `body` data since the field is of + * `bytes` type. + * + * Generated from protobuf field bytes body = 10; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The request body associated with the HTTP POST request. If `content_type` + * is `URL_ENCODED`, the body passed in must be URL-encoded. Users can + * provide a `Content-Length` header via the `headers` field or the API will + * do so. If the `request_method` is `GET` and `body` is not empty, the API + * will return an error. The maximum byte size is 1 megabyte. + * Note: If client libraries aren't used (which performs the conversion + * automatically) base64 encode your `body` data since the field is of + * `bytes` type. + * + * Generated from protobuf field bytes body = 10; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, False); + $this->body = $var; + + return $this; + } + + /** + * If present, the check will only pass if the HTTP response status code is + * in this set of status codes. If empty, the HTTP status code will only + * pass if the HTTP status code is 200-299. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode accepted_response_status_codes = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAcceptedResponseStatusCodes() + { + return $this->accepted_response_status_codes; + } + + /** + * If present, the check will only pass if the HTTP response status code is + * in this set of status codes. If empty, the HTTP status code will only + * pass if the HTTP status code is 200-299. + * + * Generated from protobuf field repeated .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode accepted_response_status_codes = 11; + * @param array<\Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ResponseStatusCode>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAcceptedResponseStatusCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ResponseStatusCode::class); + $this->accepted_response_status_codes = $arr; + + return $this; + } + + /** + * Contains information needed to add pings to an HTTP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 12; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig|null + */ + public function getPingConfig() + { + return $this->ping_config; + } + + public function hasPingConfig() + { + return isset($this->ping_config); + } + + public function clearPingConfig() + { + unset($this->ping_config); + } + + /** + * Contains information needed to add pings to an HTTP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 12; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig $var + * @return $this + */ + public function setPingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig::class); + $this->ping_config = $var; + + return $this; + } + + /** + * If specified, Uptime will generate and attach an OIDC JWT token for the + * Monitoring service agent service account as an `Authorization` header + * in the HTTP request when probing. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication service_agent_authentication = 14; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ServiceAgentAuthentication|null + */ + public function getServiceAgentAuthentication() + { + return $this->readOneof(14); + } + + public function hasServiceAgentAuthentication() + { + return $this->hasOneof(14); + } + + /** + * If specified, Uptime will generate and attach an OIDC JWT token for the + * Monitoring service agent service account as an `Authorization` header + * in the HTTP request when probing. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication service_agent_authentication = 14; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ServiceAgentAuthentication $var + * @return $this + */ + public function setServiceAgentAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ServiceAgentAuthentication::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthMethod() + { + return $this->whichOneof("auth_method"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HttpCheck::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/BasicAuthentication.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/BasicAuthentication.php new file mode 100644 index 000000000000..d193ecd51c76 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/BasicAuthentication.php @@ -0,0 +1,107 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + */ +class BasicAuthentication extends \Google\Protobuf\Internal\Message +{ + /** + * The username to use when authenticating with the HTTP server. + * + * Generated from protobuf field string username = 1; + */ + protected $username = ''; + /** + * The password to use when authenticating with the HTTP server. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * The username to use when authenticating with the HTTP server. + * @type string $password + * The password to use when authenticating with the HTTP server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * The username to use when authenticating with the HTTP server. + * + * Generated from protobuf field string username = 1; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * The username to use when authenticating with the HTTP server. + * + * Generated from protobuf field string username = 1; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * The password to use when authenticating with the HTTP server. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * The password to use when authenticating with the HTTP server. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BasicAuthentication::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_BasicAuthentication::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ContentType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ContentType.php new file mode 100644 index 000000000000..7eeb5f3ad046 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ContentType.php @@ -0,0 +1,67 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType + */ +class ContentType +{ + /** + * No content type specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * `body` is in URL-encoded form. Equivalent to setting the `Content-Type` + * to `application/x-www-form-urlencoded` in the HTTP request. + * + * Generated from protobuf enum URL_ENCODED = 1; + */ + const URL_ENCODED = 1; + /** + * `body` is in `custom_content_type` form. Equivalent to setting the + * `Content-Type` to the contents of `custom_content_type` in the HTTP + * request. + * + * Generated from protobuf enum USER_PROVIDED = 2; + */ + const USER_PROVIDED = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::URL_ENCODED => 'URL_ENCODED', + self::USER_PROVIDED => 'USER_PROVIDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ContentType::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_ContentType::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/RequestMethod.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/RequestMethod.php new file mode 100644 index 000000000000..981e2cbc3729 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/RequestMethod.php @@ -0,0 +1,64 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod + */ +class RequestMethod +{ + /** + * No request method specified. + * + * Generated from protobuf enum METHOD_UNSPECIFIED = 0; + */ + const METHOD_UNSPECIFIED = 0; + /** + * GET request. + * + * Generated from protobuf enum GET = 1; + */ + const GET = 1; + /** + * POST request. + * + * Generated from protobuf enum POST = 2; + */ + const POST = 2; + + private static $valueToName = [ + self::METHOD_UNSPECIFIED => 'METHOD_UNSPECIFIED', + self::GET => 'GET', + self::POST => 'POST', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RequestMethod::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_RequestMethod::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode.php new file mode 100644 index 000000000000..61fe31c3dabc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode.php @@ -0,0 +1,112 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode + */ +class ResponseStatusCode extends \Google\Protobuf\Internal\Message +{ + protected $status_code; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $status_value + * A status code to accept. + * @type int $status_class + * A class of status codes to accept. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * A status code to accept. + * + * Generated from protobuf field int32 status_value = 1; + * @return int + */ + public function getStatusValue() + { + return $this->readOneof(1); + } + + public function hasStatusValue() + { + return $this->hasOneof(1); + } + + /** + * A status code to accept. + * + * Generated from protobuf field int32 status_value = 1; + * @param int $var + * @return $this + */ + public function setStatusValue($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A class of status codes to accept. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.StatusClass status_class = 2; + * @return int + */ + public function getStatusClass() + { + return $this->readOneof(2); + } + + public function hasStatusClass() + { + return $this->hasOneof(2); + } + + /** + * A class of status codes to accept. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.StatusClass status_class = 2; + * @param int $var + * @return $this + */ + public function setStatusClass($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ResponseStatusCode\StatusClass::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getStatusCode() + { + return $this->whichOneof("status_code"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResponseStatusCode::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_ResponseStatusCode::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode/StatusClass.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode/StatusClass.php new file mode 100644 index 000000000000..ec9ccc03c042 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ResponseStatusCode/StatusClass.php @@ -0,0 +1,92 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.StatusClass + */ +class StatusClass +{ + /** + * Default value that matches no status codes. + * + * Generated from protobuf enum STATUS_CLASS_UNSPECIFIED = 0; + */ + const STATUS_CLASS_UNSPECIFIED = 0; + /** + * The class of status codes between 100 and 199. + * + * Generated from protobuf enum STATUS_CLASS_1XX = 100; + */ + const STATUS_CLASS_1XX = 100; + /** + * The class of status codes between 200 and 299. + * + * Generated from protobuf enum STATUS_CLASS_2XX = 200; + */ + const STATUS_CLASS_2XX = 200; + /** + * The class of status codes between 300 and 399. + * + * Generated from protobuf enum STATUS_CLASS_3XX = 300; + */ + const STATUS_CLASS_3XX = 300; + /** + * The class of status codes between 400 and 499. + * + * Generated from protobuf enum STATUS_CLASS_4XX = 400; + */ + const STATUS_CLASS_4XX = 400; + /** + * The class of status codes between 500 and 599. + * + * Generated from protobuf enum STATUS_CLASS_5XX = 500; + */ + const STATUS_CLASS_5XX = 500; + /** + * The class of all status codes. + * + * Generated from protobuf enum STATUS_CLASS_ANY = 1000; + */ + const STATUS_CLASS_ANY = 1000; + + private static $valueToName = [ + self::STATUS_CLASS_UNSPECIFIED => 'STATUS_CLASS_UNSPECIFIED', + self::STATUS_CLASS_1XX => 'STATUS_CLASS_1XX', + self::STATUS_CLASS_2XX => 'STATUS_CLASS_2XX', + self::STATUS_CLASS_3XX => 'STATUS_CLASS_3XX', + self::STATUS_CLASS_4XX => 'STATUS_CLASS_4XX', + self::STATUS_CLASS_5XX => 'STATUS_CLASS_5XX', + self::STATUS_CLASS_ANY => 'STATUS_CLASS_ANY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StatusClass::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_ResponseStatusCode_StatusClass::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication.php new file mode 100644 index 000000000000..52ef8fe4903a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication.php @@ -0,0 +1,75 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication + */ +class ServiceAgentAuthentication extends \Google\Protobuf\Internal\Message +{ + /** + * Type of authentication. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType type = 1; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Type of authentication. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * Type of authentication. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of authentication. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\HttpCheck\ServiceAgentAuthentication\ServiceAgentAuthenticationType::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ServiceAgentAuthentication::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_ServiceAgentAuthentication::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication/ServiceAgentAuthenticationType.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication/ServiceAgentAuthenticationType.php new file mode 100644 index 000000000000..8b14271b462a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/HttpCheck/ServiceAgentAuthentication/ServiceAgentAuthenticationType.php @@ -0,0 +1,57 @@ +google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType + */ +class ServiceAgentAuthenticationType +{ + /** + * Default value, will result in OIDC Authentication. + * + * Generated from protobuf enum SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED = 0; + */ + const SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED = 0; + /** + * OIDC Authentication + * + * Generated from protobuf enum OIDC_TOKEN = 1; + */ + const OIDC_TOKEN = 1; + + private static $valueToName = [ + self::SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED => 'SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED', + self::OIDC_TOKEN => 'OIDC_TOKEN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ServiceAgentAuthenticationType::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_HttpCheck_ServiceAgentAuthentication_ServiceAgentAuthenticationType::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/PingConfig.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/PingConfig.php new file mode 100644 index 000000000000..ae85d7f10477 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/PingConfig.php @@ -0,0 +1,72 @@ +google.monitoring.v3.UptimeCheckConfig.PingConfig + */ +class PingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Number of ICMP pings. A maximum of 3 ICMP pings is currently supported. + * + * Generated from protobuf field int32 pings_count = 1; + */ + protected $pings_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $pings_count + * Number of ICMP pings. A maximum of 3 ICMP pings is currently supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * Number of ICMP pings. A maximum of 3 ICMP pings is currently supported. + * + * Generated from protobuf field int32 pings_count = 1; + * @return int + */ + public function getPingsCount() + { + return $this->pings_count; + } + + /** + * Number of ICMP pings. A maximum of 3 ICMP pings is currently supported. + * + * Generated from protobuf field int32 pings_count = 1; + * @param int $var + * @return $this + */ + public function setPingsCount($var) + { + GPBUtil::checkInt32($var); + $this->pings_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PingConfig::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_PingConfig::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ResourceGroup.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ResourceGroup.php new file mode 100644 index 000000000000..25ef6cb80c61 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/ResourceGroup.php @@ -0,0 +1,113 @@ +google.monitoring.v3.UptimeCheckConfig.ResourceGroup + */ +class ResourceGroup extends \Google\Protobuf\Internal\Message +{ + /** + * The group of resources being monitored. Should be only the `[GROUP_ID]`, + * and not the full-path + * `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. + * + * Generated from protobuf field string group_id = 1; + */ + protected $group_id = ''; + /** + * The resource type of the group members. + * + * Generated from protobuf field .google.monitoring.v3.GroupResourceType resource_type = 2; + */ + protected $resource_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $group_id + * The group of resources being monitored. Should be only the `[GROUP_ID]`, + * and not the full-path + * `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. + * @type int $resource_type + * The resource type of the group members. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * The group of resources being monitored. Should be only the `[GROUP_ID]`, + * and not the full-path + * `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. + * + * Generated from protobuf field string group_id = 1; + * @return string + */ + public function getGroupId() + { + return $this->group_id; + } + + /** + * The group of resources being monitored. Should be only the `[GROUP_ID]`, + * and not the full-path + * `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. + * + * Generated from protobuf field string group_id = 1; + * @param string $var + * @return $this + */ + public function setGroupId($var) + { + GPBUtil::checkString($var, True); + $this->group_id = $var; + + return $this; + } + + /** + * The resource type of the group members. + * + * Generated from protobuf field .google.monitoring.v3.GroupResourceType resource_type = 2; + * @return int + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * The resource type of the group members. + * + * Generated from protobuf field .google.monitoring.v3.GroupResourceType resource_type = 2; + * @param int $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\GroupResourceType::class); + $this->resource_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResourceGroup::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_ResourceGroup::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/TcpCheck.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/TcpCheck.php new file mode 100644 index 000000000000..09c0668c3b3b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckConfig/TcpCheck.php @@ -0,0 +1,122 @@ +google.monitoring.v3.UptimeCheckConfig.TcpCheck + */ +class TcpCheck extends \Google\Protobuf\Internal\Message +{ + /** + * The TCP port on the server against which to run the check. Will be + * combined with host (specified within the `monitored_resource`) to + * construct the full URL. Required. + * + * Generated from protobuf field int32 port = 1; + */ + protected $port = 0; + /** + * Contains information needed to add pings to a TCP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 2; + */ + protected $ping_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $port + * The TCP port on the server against which to run the check. Will be + * combined with host (specified within the `monitored_resource`) to + * construct the full URL. Required. + * @type \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig $ping_config + * Contains information needed to add pings to a TCP check. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * The TCP port on the server against which to run the check. Will be + * combined with host (specified within the `monitored_resource`) to + * construct the full URL. Required. + * + * Generated from protobuf field int32 port = 1; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The TCP port on the server against which to run the check. Will be + * combined with host (specified within the `monitored_resource`) to + * construct the full URL. Required. + * + * Generated from protobuf field int32 port = 1; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * Contains information needed to add pings to a TCP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 2; + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig|null + */ + public function getPingConfig() + { + return $this->ping_config; + } + + public function hasPingConfig() + { + return isset($this->ping_config); + } + + public function clearPingConfig() + { + unset($this->ping_config); + } + + /** + * Contains information needed to add pings to a TCP check. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckConfig.PingConfig ping_config = 2; + * @param \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig $var + * @return $this + */ + public function setPingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\UptimeCheckConfig\PingConfig::class); + $this->ping_config = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TcpCheck::class, \Google\Cloud\Monitoring\V3\UptimeCheckConfig_TcpCheck::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckIp.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckIp.php new file mode 100644 index 000000000000..8eb3b2a696b7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckIp.php @@ -0,0 +1,160 @@ +google.monitoring.v3.UptimeCheckIp + */ +class UptimeCheckIp extends \Google\Protobuf\Internal\Message +{ + /** + * A broad region category in which the IP address is located. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckRegion region = 1; + */ + protected $region = 0; + /** + * A more specific location within the region that typically encodes + * a particular city/town/metro (and its containing state/province or country) + * within the broader umbrella region category. + * + * Generated from protobuf field string location = 2; + */ + protected $location = ''; + /** + * The IP address from which the Uptime check originates. This is a fully + * specified IP address (not an IP address range). Most IP addresses, as of + * this publication, are in IPv4 format; however, one should not rely on the + * IP addresses being in IPv4 format indefinitely, and should support + * interpreting this field in either IPv4 or IPv6 format. + * + * Generated from protobuf field string ip_address = 3; + */ + protected $ip_address = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $region + * A broad region category in which the IP address is located. + * @type string $location + * A more specific location within the region that typically encodes + * a particular city/town/metro (and its containing state/province or country) + * within the broader umbrella region category. + * @type string $ip_address + * The IP address from which the Uptime check originates. This is a fully + * specified IP address (not an IP address range). Most IP addresses, as of + * this publication, are in IPv4 format; however, one should not rely on the + * IP addresses being in IPv4 format indefinitely, and should support + * interpreting this field in either IPv4 or IPv6 format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Uptime::initOnce(); + parent::__construct($data); + } + + /** + * A broad region category in which the IP address is located. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckRegion region = 1; + * @return int + */ + public function getRegion() + { + return $this->region; + } + + /** + * A broad region category in which the IP address is located. + * + * Generated from protobuf field .google.monitoring.v3.UptimeCheckRegion region = 1; + * @param int $var + * @return $this + */ + public function setRegion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckRegion::class); + $this->region = $var; + + return $this; + } + + /** + * A more specific location within the region that typically encodes + * a particular city/town/metro (and its containing state/province or country) + * within the broader umbrella region category. + * + * Generated from protobuf field string location = 2; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * A more specific location within the region that typically encodes + * a particular city/town/metro (and its containing state/province or country) + * within the broader umbrella region category. + * + * Generated from protobuf field string location = 2; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The IP address from which the Uptime check originates. This is a fully + * specified IP address (not an IP address range). Most IP addresses, as of + * this publication, are in IPv4 format; however, one should not rely on the + * IP addresses being in IPv4 format indefinitely, and should support + * interpreting this field in either IPv4 or IPv6 format. + * + * Generated from protobuf field string ip_address = 3; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * The IP address from which the Uptime check originates. This is a fully + * specified IP address (not an IP address range). Most IP addresses, as of + * this publication, are in IPv4 format; however, one should not rely on the + * IP addresses being in IPv4 format indefinitely, and should support + * interpreting this field in either IPv4 or IPv6 format. + * + * Generated from protobuf field string ip_address = 3; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckRegion.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckRegion.php new file mode 100644 index 000000000000..8524b68cf0f7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/UptimeCheckRegion.php @@ -0,0 +1,102 @@ +google.monitoring.v3.UptimeCheckRegion + */ +class UptimeCheckRegion +{ + /** + * Default value if no region is specified. Will result in Uptime checks + * running from all regions. + * + * Generated from protobuf enum REGION_UNSPECIFIED = 0; + */ + const REGION_UNSPECIFIED = 0; + /** + * Allows checks to run from locations within the United States of America. + * + * Generated from protobuf enum USA = 1; + */ + const USA = 1; + /** + * Allows checks to run from locations within the continent of Europe. + * + * Generated from protobuf enum EUROPE = 2; + */ + const EUROPE = 2; + /** + * Allows checks to run from locations within the continent of South + * America. + * + * Generated from protobuf enum SOUTH_AMERICA = 3; + */ + const SOUTH_AMERICA = 3; + /** + * Allows checks to run from locations within the Asia Pacific area (ex: + * Singapore). + * + * Generated from protobuf enum ASIA_PACIFIC = 4; + */ + const ASIA_PACIFIC = 4; + /** + * Allows checks to run from locations within the western United States of + * America + * + * Generated from protobuf enum USA_OREGON = 5; + */ + const USA_OREGON = 5; + /** + * Allows checks to run from locations within the central United States of + * America + * + * Generated from protobuf enum USA_IOWA = 6; + */ + const USA_IOWA = 6; + /** + * Allows checks to run from locations within the eastern United States of + * America + * + * Generated from protobuf enum USA_VIRGINIA = 7; + */ + const USA_VIRGINIA = 7; + + private static $valueToName = [ + self::REGION_UNSPECIFIED => 'REGION_UNSPECIFIED', + self::USA => 'USA', + self::EUROPE => 'EUROPE', + self::SOUTH_AMERICA => 'SOUTH_AMERICA', + self::ASIA_PACIFIC => 'ASIA_PACIFIC', + self::USA_OREGON => 'USA_OREGON', + self::USA_IOWA => 'USA_IOWA', + self::USA_VIRGINIA => 'USA_VIRGINIA', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/VerifyNotificationChannelRequest.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/VerifyNotificationChannelRequest.php new file mode 100644 index 000000000000..95410209d065 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/VerifyNotificationChannelRequest.php @@ -0,0 +1,147 @@ +google.monitoring.v3.VerifyNotificationChannelRequest + */ +class VerifyNotificationChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The notification channel to verify. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * + * Generated from protobuf field string code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $code = ''; + + /** + * @param string $name Required. The notification channel to verify. Please see + * {@see NotificationChannelServiceClient::notificationChannelName()} for help formatting this field. + * @param string $code Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * + * @return \Google\Cloud\Monitoring\V3\VerifyNotificationChannelRequest + * + * @experimental + */ + public static function build(string $name, string $code): self + { + return (new self()) + ->setName($name) + ->setCode($code); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The notification channel to verify. + * @type string $code + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\NotificationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The notification channel to verify. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The notification channel to verify. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * + * Generated from protobuf field string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * + * Generated from protobuf field string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli.php new file mode 100644 index 000000000000..f049ead8c434 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli.php @@ -0,0 +1,236 @@ +google.monitoring.v3.WindowsBasedSli + */ +class WindowsBasedSli extends \Google\Protobuf\Internal\Message +{ + /** + * Duration over which window quality is evaluated. Must be an integer + * fraction of a day and at least `60s`. + * + * Generated from protobuf field .google.protobuf.Duration window_period = 4; + */ + protected $window_period = null; + protected $window_criterion; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $good_bad_metric_filter + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if + * any `true` values appear in the window. + * @type \Google\Cloud\Monitoring\V3\WindowsBasedSli\PerformanceThreshold $good_total_ratio_threshold + * A window is good if its `performance` is high enough. + * @type \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange $metric_mean_in_range + * A window is good if the metric's value is in a good range, averaged + * across returned streams. + * @type \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange $metric_sum_in_range + * A window is good if the metric's value is in a good range, summed across + * returned streams. + * @type \Google\Protobuf\Duration $window_period + * Duration over which window quality is evaluated. Must be an integer + * fraction of a day and at least `60s`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if + * any `true` values appear in the window. + * + * Generated from protobuf field string good_bad_metric_filter = 5; + * @return string + */ + public function getGoodBadMetricFilter() + { + return $this->readOneof(5); + } + + public function hasGoodBadMetricFilter() + { + return $this->hasOneof(5); + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if + * any `true` values appear in the window. + * + * Generated from protobuf field string good_bad_metric_filter = 5; + * @param string $var + * @return $this + */ + public function setGoodBadMetricFilter($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A window is good if its `performance` is high enough. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.PerformanceThreshold good_total_ratio_threshold = 2; + * @return \Google\Cloud\Monitoring\V3\WindowsBasedSli\PerformanceThreshold|null + */ + public function getGoodTotalRatioThreshold() + { + return $this->readOneof(2); + } + + public function hasGoodTotalRatioThreshold() + { + return $this->hasOneof(2); + } + + /** + * A window is good if its `performance` is high enough. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.PerformanceThreshold good_total_ratio_threshold = 2; + * @param \Google\Cloud\Monitoring\V3\WindowsBasedSli\PerformanceThreshold $var + * @return $this + */ + public function setGoodTotalRatioThreshold($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\WindowsBasedSli\PerformanceThreshold::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A window is good if the metric's value is in a good range, averaged + * across returned streams. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.MetricRange metric_mean_in_range = 6; + * @return \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange|null + */ + public function getMetricMeanInRange() + { + return $this->readOneof(6); + } + + public function hasMetricMeanInRange() + { + return $this->hasOneof(6); + } + + /** + * A window is good if the metric's value is in a good range, averaged + * across returned streams. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.MetricRange metric_mean_in_range = 6; + * @param \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange $var + * @return $this + */ + public function setMetricMeanInRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * A window is good if the metric's value is in a good range, summed across + * returned streams. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.MetricRange metric_sum_in_range = 7; + * @return \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange|null + */ + public function getMetricSumInRange() + { + return $this->readOneof(7); + } + + public function hasMetricSumInRange() + { + return $this->hasOneof(7); + } + + /** + * A window is good if the metric's value is in a good range, summed across + * returned streams. + * + * Generated from protobuf field .google.monitoring.v3.WindowsBasedSli.MetricRange metric_sum_in_range = 7; + * @param \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange $var + * @return $this + */ + public function setMetricSumInRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\WindowsBasedSli\MetricRange::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Duration over which window quality is evaluated. Must be an integer + * fraction of a day and at least `60s`. + * + * Generated from protobuf field .google.protobuf.Duration window_period = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getWindowPeriod() + { + return $this->window_period; + } + + public function hasWindowPeriod() + { + return isset($this->window_period); + } + + public function clearWindowPeriod() + { + unset($this->window_period); + } + + /** + * Duration over which window quality is evaluated. Must be an integer + * fraction of a day and at least `60s`. + * + * Generated from protobuf field .google.protobuf.Duration window_period = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setWindowPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->window_period = $var; + + return $this; + } + + /** + * @return string + */ + public function getWindowCriterion() + { + return $this->whichOneof("window_criterion"); + } + +} + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/MetricRange.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/MetricRange.php new file mode 100644 index 000000000000..2a86a24e4eab --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/MetricRange.php @@ -0,0 +1,125 @@ +google.monitoring.v3.WindowsBasedSli.MetricRange + */ +class MetricRange extends \Google\Protobuf\Internal\Message +{ + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying the `TimeSeries` to use for evaluating window quality. + * + * Generated from protobuf field string time_series = 1; + */ + protected $time_series = ''; + /** + * Range of values considered "good." For a one-sided range, set one bound + * to an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 4; + */ + protected $range = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $time_series + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying the `TimeSeries` to use for evaluating window quality. + * @type \Google\Cloud\Monitoring\V3\Range $range + * Range of values considered "good." For a one-sided range, set one bound + * to an infinite value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying the `TimeSeries` to use for evaluating window quality. + * + * Generated from protobuf field string time_series = 1; + * @return string + */ + public function getTimeSeries() + { + return $this->time_series; + } + + /** + * A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifying the `TimeSeries` to use for evaluating window quality. + * + * Generated from protobuf field string time_series = 1; + * @param string $var + * @return $this + */ + public function setTimeSeries($var) + { + GPBUtil::checkString($var, True); + $this->time_series = $var; + + return $this; + } + + /** + * Range of values considered "good." For a one-sided range, set one bound + * to an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 4; + * @return \Google\Cloud\Monitoring\V3\Range|null + */ + public function getRange() + { + return $this->range; + } + + public function hasRange() + { + return isset($this->range); + } + + public function clearRange() + { + unset($this->range); + } + + /** + * Range of values considered "good." For a one-sided range, set one bound + * to an infinite value. + * + * Generated from protobuf field .google.monitoring.v3.Range range = 4; + * @param \Google\Cloud\Monitoring\V3\Range $var + * @return $this + */ + public function setRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\Range::class); + $this->range = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricRange::class, \Google\Cloud\Monitoring\V3\WindowsBasedSli_MetricRange::class); + diff --git a/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/PerformanceThreshold.php b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/PerformanceThreshold.php new file mode 100644 index 000000000000..7ff22f3a6770 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/proto/src/Google/Cloud/Monitoring/V3/WindowsBasedSli/PerformanceThreshold.php @@ -0,0 +1,146 @@ +google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + */ +class PerformanceThreshold extends \Google\Protobuf\Internal\Message +{ + /** + * If window `performance >= threshold`, the window is counted as good. + * + * Generated from protobuf field double threshold = 2; + */ + protected $threshold = 0.0; + protected $type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Monitoring\V3\RequestBasedSli $performance + * `RequestBasedSli` to evaluate to judge window quality. + * @type \Google\Cloud\Monitoring\V3\BasicSli $basic_sli_performance + * `BasicSli` to evaluate to judge window quality. + * @type float $threshold + * If window `performance >= threshold`, the window is counted as good. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Monitoring\V3\Service::initOnce(); + parent::__construct($data); + } + + /** + * `RequestBasedSli` to evaluate to judge window quality. + * + * Generated from protobuf field .google.monitoring.v3.RequestBasedSli performance = 1; + * @return \Google\Cloud\Monitoring\V3\RequestBasedSli|null + */ + public function getPerformance() + { + return $this->readOneof(1); + } + + public function hasPerformance() + { + return $this->hasOneof(1); + } + + /** + * `RequestBasedSli` to evaluate to judge window quality. + * + * Generated from protobuf field .google.monitoring.v3.RequestBasedSli performance = 1; + * @param \Google\Cloud\Monitoring\V3\RequestBasedSli $var + * @return $this + */ + public function setPerformance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\RequestBasedSli::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * `BasicSli` to evaluate to judge window quality. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli basic_sli_performance = 3; + * @return \Google\Cloud\Monitoring\V3\BasicSli|null + */ + public function getBasicSliPerformance() + { + return $this->readOneof(3); + } + + public function hasBasicSliPerformance() + { + return $this->hasOneof(3); + } + + /** + * `BasicSli` to evaluate to judge window quality. + * + * Generated from protobuf field .google.monitoring.v3.BasicSli basic_sli_performance = 3; + * @param \Google\Cloud\Monitoring\V3\BasicSli $var + * @return $this + */ + public function setBasicSliPerformance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\BasicSli::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * If window `performance >= threshold`, the window is counted as good. + * + * Generated from protobuf field double threshold = 2; + * @return float + */ + public function getThreshold() + { + return $this->threshold; + } + + /** + * If window `performance >= threshold`, the window is counted as good. + * + * Generated from protobuf field double threshold = 2; + * @param float $var + * @return $this + */ + public function setThreshold($var) + { + GPBUtil::checkDouble($var); + $this->threshold = $var; + + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->whichOneof("type"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PerformanceThreshold::class, \Google\Cloud\Monitoring\V3\WindowsBasedSli_PerformanceThreshold::class); + diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/create_alert_policy.php b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/create_alert_policy.php new file mode 100644 index 000000000000..8da94f5c6a84 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/create_alert_policy.php @@ -0,0 +1,88 @@ +setName($name) + ->setAlertPolicy($alertPolicy); + + // Call the API and handle any network failures. + try { + /** @var AlertPolicy $response */ + $response = $alertPolicyServiceClient->createAlertPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + create_alert_policy_sample($name); +} +// [END monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/delete_alert_policy.php b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/delete_alert_policy.php new file mode 100644 index 000000000000..20341bb9cedc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/delete_alert_policy.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $alertPolicyServiceClient->deleteAlertPolicy($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AlertPolicyServiceClient::alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + + delete_alert_policy_sample($formattedName); +} +// [END monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/get_alert_policy.php b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/get_alert_policy.php new file mode 100644 index 000000000000..a6b8ef21ad66 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/get_alert_policy.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AlertPolicy $response */ + $response = $alertPolicyServiceClient->getAlertPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AlertPolicyServiceClient::alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + + get_alert_policy_sample($formattedName); +} +// [END monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/list_alert_policies.php b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/list_alert_policies.php new file mode 100644 index 000000000000..dc60fddad14f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/list_alert_policies.php @@ -0,0 +1,85 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $alertPolicyServiceClient->listAlertPolicies($request); + + /** @var AlertPolicy $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_alert_policies_sample($name); +} +// [END monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/update_alert_policy.php b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/update_alert_policy.php new file mode 100644 index 000000000000..d4f9c5060ec7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/AlertPolicyServiceClient/update_alert_policy.php @@ -0,0 +1,66 @@ +setAlertPolicy($alertPolicy); + + // Call the API and handle any network failures. + try { + /** @var AlertPolicy $response */ + $response = $alertPolicyServiceClient->updateAlertPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/create_group.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/create_group.php new file mode 100644 index 000000000000..5662f185f72e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/create_group.php @@ -0,0 +1,76 @@ +setName($name) + ->setGroup($group); + + // Call the API and handle any network failures. + try { + /** @var Group $response */ + $response = $groupServiceClient->createGroup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + create_group_sample($name); +} +// [END monitoring_v3_generated_GroupService_CreateGroup_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/delete_group.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/delete_group.php new file mode 100644 index 000000000000..2b0b5d393b35 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/delete_group.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $groupServiceClient->deleteGroup($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GroupServiceClient::groupName('[PROJECT]', '[GROUP]'); + + delete_group_sample($formattedName); +} +// [END monitoring_v3_generated_GroupService_DeleteGroup_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/get_group.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/get_group.php new file mode 100644 index 000000000000..59d00116484a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/get_group.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Group $response */ + $response = $groupServiceClient->getGroup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GroupServiceClient::groupName('[PROJECT]', '[GROUP]'); + + get_group_sample($formattedName); +} +// [END monitoring_v3_generated_GroupService_GetGroup_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_group_members.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_group_members.php new file mode 100644 index 000000000000..810ef1fb51ce --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_group_members.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $groupServiceClient->listGroupMembers($request); + + /** @var MonitoredResource $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GroupServiceClient::groupName('[PROJECT]', '[GROUP]'); + + list_group_members_sample($formattedName); +} +// [END monitoring_v3_generated_GroupService_ListGroupMembers_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_groups.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_groups.php new file mode 100644 index 000000000000..073f54a6f17e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/list_groups.php @@ -0,0 +1,79 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $groupServiceClient->listGroups($request); + + /** @var Group $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_groups_sample($name); +} +// [END monitoring_v3_generated_GroupService_ListGroups_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/update_group.php b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/update_group.php new file mode 100644 index 000000000000..58d8ed1e52b3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/GroupServiceClient/update_group.php @@ -0,0 +1,60 @@ +setGroup($group); + + // Call the API and handle any network failures. + try { + /** @var Group $response */ + $response = $groupServiceClient->updateGroup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_GroupService_UpdateGroup_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_metric_descriptor.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_metric_descriptor.php new file mode 100644 index 000000000000..c54f10ba5a8b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_metric_descriptor.php @@ -0,0 +1,81 @@ +setName($name) + ->setMetricDescriptor($metricDescriptor); + + // Call the API and handle any network failures. + try { + /** @var MetricDescriptor $response */ + $response = $metricServiceClient->createMetricDescriptor($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + create_metric_descriptor_sample($name); +} +// [END monitoring_v3_generated_MetricService_CreateMetricDescriptor_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_service_time_series.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_service_time_series.php new file mode 100644 index 000000000000..3676da8a884a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_service_time_series.php @@ -0,0 +1,84 @@ +setName($formattedName) + ->setTimeSeries($timeSeries); + + // Call the API and handle any network failures. + try { + $metricServiceClient->createServiceTimeSeries($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::projectName('[PROJECT]'); + + create_service_time_series_sample($formattedName); +} +// [END monitoring_v3_generated_MetricService_CreateServiceTimeSeries_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_time_series.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_time_series.php new file mode 100644 index 000000000000..943e3d74156e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/create_time_series.php @@ -0,0 +1,82 @@ +setName($formattedName) + ->setTimeSeries($timeSeries); + + // Call the API and handle any network failures. + try { + $metricServiceClient->createTimeSeries($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::projectName('[PROJECT]'); + + create_time_series_sample($formattedName); +} +// [END monitoring_v3_generated_MetricService_CreateTimeSeries_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/delete_metric_descriptor.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/delete_metric_descriptor.php new file mode 100644 index 000000000000..5be71ec658ad --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/delete_metric_descriptor.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $metricServiceClient->deleteMetricDescriptor($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + + delete_metric_descriptor_sample($formattedName); +} +// [END monitoring_v3_generated_MetricService_DeleteMetricDescriptor_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_metric_descriptor.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_metric_descriptor.php new file mode 100644 index 000000000000..f1733d7ebcf3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_metric_descriptor.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MetricDescriptor $response */ + $response = $metricServiceClient->getMetricDescriptor($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + + get_metric_descriptor_sample($formattedName); +} +// [END monitoring_v3_generated_MetricService_GetMetricDescriptor_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_monitored_resource_descriptor.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_monitored_resource_descriptor.php new file mode 100644 index 000000000000..b80928f31d40 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/get_monitored_resource_descriptor.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MonitoredResourceDescriptor $response */ + $response = $metricServiceClient->getMonitoredResourceDescriptor($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::monitoredResourceDescriptorName( + '[PROJECT]', + '[MONITORED_RESOURCE_DESCRIPTOR]' + ); + + get_monitored_resource_descriptor_sample($formattedName); +} +// [END monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_metric_descriptors.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_metric_descriptors.php new file mode 100644 index 000000000000..2a60d376cdf4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_metric_descriptors.php @@ -0,0 +1,79 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $metricServiceClient->listMetricDescriptors($request); + + /** @var MetricDescriptor $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_metric_descriptors_sample($name); +} +// [END monitoring_v3_generated_MetricService_ListMetricDescriptors_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_monitored_resource_descriptors.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_monitored_resource_descriptors.php new file mode 100644 index 000000000000..8594af87cfce --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_monitored_resource_descriptors.php @@ -0,0 +1,79 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $metricServiceClient->listMonitoredResourceDescriptors($request); + + /** @var MonitoredResourceDescriptor $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_monitored_resource_descriptors_sample($name); +} +// [END monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_time_series.php b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_time_series.php new file mode 100644 index 000000000000..2d408169cc27 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/MetricServiceClient/list_time_series.php @@ -0,0 +1,99 @@ +setName($formattedName) + ->setFilter($filter) + ->setInterval($interval) + ->setView($view); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $metricServiceClient->listTimeSeries($request); + + /** @var TimeSeries $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MetricServiceClient::workspaceName('[PROJECT]'); + $filter = '[FILTER]'; + $view = TimeSeriesView::FULL; + + list_time_series_sample($formattedName, $filter, $view); +} +// [END monitoring_v3_generated_MetricService_ListTimeSeries_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/create_notification_channel.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/create_notification_channel.php new file mode 100644 index 000000000000..4e2647ee0231 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/create_notification_channel.php @@ -0,0 +1,87 @@ +setName($name) + ->setNotificationChannel($notificationChannel); + + // Call the API and handle any network failures. + try { + /** @var NotificationChannel $response */ + $response = $notificationChannelServiceClient->createNotificationChannel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + create_notification_channel_sample($name); +} +// [END monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/delete_notification_channel.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/delete_notification_channel.php new file mode 100644 index 000000000000..1af1aacc41e0 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/delete_notification_channel.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $notificationChannelServiceClient->deleteNotificationChannel($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelName( + '[PROJECT]', + '[NOTIFICATION_CHANNEL]' + ); + + delete_notification_channel_sample($formattedName); +} +// [END monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel.php new file mode 100644 index 000000000000..a1efeebeec4a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var NotificationChannel $response */ + $response = $notificationChannelServiceClient->getNotificationChannel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelName( + '[PROJECT]', + '[NOTIFICATION_CHANNEL]' + ); + + get_notification_channel_sample($formattedName); +} +// [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_descriptor.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_descriptor.php new file mode 100644 index 000000000000..3f4bc0a77317 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_descriptor.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var NotificationChannelDescriptor $response */ + $response = $notificationChannelServiceClient->getNotificationChannelDescriptor($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelDescriptorName( + '[PROJECT]', + '[CHANNEL_DESCRIPTOR]' + ); + + get_notification_channel_descriptor_sample($formattedName); +} +// [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_verification_code.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_verification_code.php new file mode 100644 index 000000000000..a63472001e29 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/get_notification_channel_verification_code.php @@ -0,0 +1,96 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var GetNotificationChannelVerificationCodeResponse $response */ + $response = $notificationChannelServiceClient->getNotificationChannelVerificationCode($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelName( + '[PROJECT]', + '[NOTIFICATION_CHANNEL]' + ); + + get_notification_channel_verification_code_sample($formattedName); +} +// [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channel_descriptors.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channel_descriptors.php new file mode 100644 index 000000000000..0382fad734f1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channel_descriptors.php @@ -0,0 +1,86 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $notificationChannelServiceClient->listNotificationChannelDescriptors($request); + + /** @var NotificationChannelDescriptor $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_notification_channel_descriptors_sample($name); +} +// [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channels.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channels.php new file mode 100644 index 000000000000..4a236f89c3ab --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/list_notification_channels.php @@ -0,0 +1,88 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $notificationChannelServiceClient->listNotificationChannels($request); + + /** @var NotificationChannel $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + list_notification_channels_sample($name); +} +// [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/send_notification_channel_verification_code.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/send_notification_channel_verification_code.php new file mode 100644 index 000000000000..b8810b7a3018 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/send_notification_channel_verification_code.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $notificationChannelServiceClient->sendNotificationChannelVerificationCode($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelName( + '[PROJECT]', + '[NOTIFICATION_CHANNEL]' + ); + + send_notification_channel_verification_code_sample($formattedName); +} +// [END monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/update_notification_channel.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/update_notification_channel.php new file mode 100644 index 000000000000..ad79286eff6b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/update_notification_channel.php @@ -0,0 +1,65 @@ +setNotificationChannel($notificationChannel); + + // Call the API and handle any network failures. + try { + /** @var NotificationChannel $response */ + $response = $notificationChannelServiceClient->updateNotificationChannel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/verify_notification_channel.php b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/verify_notification_channel.php new file mode 100644 index 000000000000..7603415aff57 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/NotificationChannelServiceClient/verify_notification_channel.php @@ -0,0 +1,85 @@ +setName($formattedName) + ->setCode($code); + + // Call the API and handle any network failures. + try { + /** @var NotificationChannel $response */ + $response = $notificationChannelServiceClient->verifyNotificationChannel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = NotificationChannelServiceClient::notificationChannelName( + '[PROJECT]', + '[NOTIFICATION_CHANNEL]' + ); + $code = '[CODE]'; + + verify_notification_channel_sample($formattedName, $code); +} +// [END monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/QueryServiceClient/query_time_series.php b/owl-bot-staging/Monitoring/v3/samples/V3/QueryServiceClient/query_time_series.php new file mode 100644 index 000000000000..bfd4ca0d6e6c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/QueryServiceClient/query_time_series.php @@ -0,0 +1,87 @@ +setName($name) + ->setQuery($query); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $queryServiceClient->queryTimeSeries($request); + + /** @var TimeSeriesData $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + $query = '[QUERY]'; + + query_time_series_sample($name, $query); +} +// [END monitoring_v3_generated_QueryService_QueryTimeSeries_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service.php new file mode 100644 index 000000000000..f1cd6dae9947 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service.php @@ -0,0 +1,76 @@ +setParent($parent) + ->setService($service); + + // Call the API and handle any network failures. + try { + /** @var Service $response */ + $response = $serviceMonitoringServiceClient->createService($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + + create_service_sample($parent); +} +// [END monitoring_v3_generated_ServiceMonitoringService_CreateService_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service_level_objective.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service_level_objective.php new file mode 100644 index 000000000000..2559795e52e7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/create_service_level_objective.php @@ -0,0 +1,75 @@ +setParent($formattedParent) + ->setServiceLevelObjective($serviceLevelObjective); + + // Call the API and handle any network failures. + try { + /** @var ServiceLevelObjective $response */ + $response = $serviceMonitoringServiceClient->createServiceLevelObjective($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ServiceMonitoringServiceClient::serviceName('[PROJECT]', '[SERVICE]'); + + create_service_level_objective_sample($formattedParent); +} +// [END monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service.php new file mode 100644 index 000000000000..dd319f9e6108 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $serviceMonitoringServiceClient->deleteService($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ServiceMonitoringServiceClient::serviceName('[PROJECT]', '[SERVICE]'); + + delete_service_sample($formattedName); +} +// [END monitoring_v3_generated_ServiceMonitoringService_DeleteService_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service_level_objective.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service_level_objective.php new file mode 100644 index 000000000000..ca3c81872464 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/delete_service_level_objective.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $serviceMonitoringServiceClient->deleteServiceLevelObjective($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ServiceMonitoringServiceClient::serviceLevelObjectiveName( + '[PROJECT]', + '[SERVICE]', + '[SERVICE_LEVEL_OBJECTIVE]' + ); + + delete_service_level_objective_sample($formattedName); +} +// [END monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service.php new file mode 100644 index 000000000000..cb12b2fcac7f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Service $response */ + $response = $serviceMonitoringServiceClient->getService($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ServiceMonitoringServiceClient::serviceName('[PROJECT]', '[SERVICE]'); + + get_service_sample($formattedName); +} +// [END monitoring_v3_generated_ServiceMonitoringService_GetService_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service_level_objective.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service_level_objective.php new file mode 100644 index 000000000000..7bc8c814262f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/get_service_level_objective.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ServiceLevelObjective $response */ + $response = $serviceMonitoringServiceClient->getServiceLevelObjective($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ServiceMonitoringServiceClient::serviceLevelObjectiveName( + '[PROJECT]', + '[SERVICE]', + '[SERVICE_LEVEL_OBJECTIVE]' + ); + + get_service_level_objective_sample($formattedName); +} +// [END monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_service_level_objectives.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_service_level_objectives.php new file mode 100644 index 000000000000..4476bfaaafda --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_service_level_objectives.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $serviceMonitoringServiceClient->listServiceLevelObjectives($request); + + /** @var ServiceLevelObjective $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ServiceMonitoringServiceClient::serviceName('[PROJECT]', '[SERVICE]'); + + list_service_level_objectives_sample($formattedParent); +} +// [END monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_services.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_services.php new file mode 100644 index 000000000000..f1495ce77ad6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/list_services.php @@ -0,0 +1,80 @@ +setParent($parent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $serviceMonitoringServiceClient->listServices($request); + + /** @var Service $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + + list_services_sample($parent); +} +// [END monitoring_v3_generated_ServiceMonitoringService_ListServices_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service.php new file mode 100644 index 000000000000..1a9fbecdfd95 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service.php @@ -0,0 +1,59 @@ +setService($service); + + // Call the API and handle any network failures. + try { + /** @var Service $response */ + $response = $serviceMonitoringServiceClient->updateService($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_ServiceMonitoringService_UpdateService_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service_level_objective.php b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service_level_objective.php new file mode 100644 index 000000000000..30611bd57c1b --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/ServiceMonitoringServiceClient/update_service_level_objective.php @@ -0,0 +1,59 @@ +setServiceLevelObjective($serviceLevelObjective); + + // Call the API and handle any network failures. + try { + /** @var ServiceLevelObjective $response */ + $response = $serviceMonitoringServiceClient->updateServiceLevelObjective($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/create_snooze.php b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/create_snooze.php new file mode 100644 index 000000000000..ee2cdecb18fb --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/create_snooze.php @@ -0,0 +1,89 @@ +setCriteria($snoozeCriteria) + ->setInterval($snoozeInterval) + ->setDisplayName($snoozeDisplayName); + $request = (new CreateSnoozeRequest()) + ->setParent($formattedParent) + ->setSnooze($snooze); + + // Call the API and handle any network failures. + try { + /** @var Snooze $response */ + $response = $snoozeServiceClient->createSnooze($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SnoozeServiceClient::workspaceName('[PROJECT]'); + $snoozeDisplayName = '[DISPLAY_NAME]'; + + create_snooze_sample($formattedParent, $snoozeDisplayName); +} +// [END monitoring_v3_generated_SnoozeService_CreateSnooze_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/get_snooze.php b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/get_snooze.php new file mode 100644 index 000000000000..cf467e5c3c3d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/get_snooze.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Snooze $response */ + $response = $snoozeServiceClient->getSnooze($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SnoozeServiceClient::snoozeName('[PROJECT]', '[SNOOZE]'); + + get_snooze_sample($formattedName); +} +// [END monitoring_v3_generated_SnoozeService_GetSnooze_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/list_snoozes.php b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/list_snoozes.php new file mode 100644 index 000000000000..f0fb94d66018 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/list_snoozes.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $snoozeServiceClient->listSnoozes($request); + + /** @var Snooze $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SnoozeServiceClient::workspaceName('[PROJECT]'); + + list_snoozes_sample($formattedParent); +} +// [END monitoring_v3_generated_SnoozeService_ListSnoozes_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/update_snooze.php b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/update_snooze.php new file mode 100644 index 000000000000..923e1a90c280 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/SnoozeServiceClient/update_snooze.php @@ -0,0 +1,83 @@ +setCriteria($snoozeCriteria) + ->setInterval($snoozeInterval) + ->setDisplayName($snoozeDisplayName); + $updateMask = new FieldMask(); + $request = (new UpdateSnoozeRequest()) + ->setSnooze($snooze) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var Snooze $response */ + $response = $snoozeServiceClient->updateSnooze($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $snoozeDisplayName = '[DISPLAY_NAME]'; + + update_snooze_sample($snoozeDisplayName); +} +// [END monitoring_v3_generated_SnoozeService_UpdateSnooze_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/create_uptime_check_config.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/create_uptime_check_config.php new file mode 100644 index 000000000000..6ad37bedcda5 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/create_uptime_check_config.php @@ -0,0 +1,76 @@ +setParent($parent) + ->setUptimeCheckConfig($uptimeCheckConfig); + + // Call the API and handle any network failures. + try { + /** @var UptimeCheckConfig $response */ + $response = $uptimeCheckServiceClient->createUptimeCheckConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + + create_uptime_check_config_sample($parent); +} +// [END monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/delete_uptime_check_config.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/delete_uptime_check_config.php new file mode 100644 index 000000000000..d33f28aec3ef --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/delete_uptime_check_config.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $uptimeCheckServiceClient->deleteUptimeCheckConfig($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = UptimeCheckServiceClient::uptimeCheckConfigName( + '[PROJECT]', + '[UPTIME_CHECK_CONFIG]' + ); + + delete_uptime_check_config_sample($formattedName); +} +// [END monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/get_uptime_check_config.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/get_uptime_check_config.php new file mode 100644 index 000000000000..a3dbc0e2c419 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/get_uptime_check_config.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var UptimeCheckConfig $response */ + $response = $uptimeCheckServiceClient->getUptimeCheckConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = UptimeCheckServiceClient::uptimeCheckConfigName( + '[PROJECT]', + '[UPTIME_CHECK_CONFIG]' + ); + + get_uptime_check_config_sample($formattedName); +} +// [END monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_configs.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_configs.php new file mode 100644 index 000000000000..7a681db45273 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_configs.php @@ -0,0 +1,80 @@ +setParent($parent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $uptimeCheckServiceClient->listUptimeCheckConfigs($request); + + /** @var UptimeCheckConfig $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + + list_uptime_check_configs_sample($parent); +} +// [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_ips.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_ips.php new file mode 100644 index 000000000000..d719dced3cfa --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/list_uptime_check_ips.php @@ -0,0 +1,62 @@ +listUptimeCheckIps($request); + + /** @var UptimeCheckIp $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_sync] diff --git a/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/update_uptime_check_config.php b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/update_uptime_check_config.php new file mode 100644 index 000000000000..cdef12857a2e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/samples/V3/UptimeCheckServiceClient/update_uptime_check_config.php @@ -0,0 +1,62 @@ +setUptimeCheckConfig($uptimeCheckConfig); + + // Call the API and handle any network failures. + try { + /** @var UptimeCheckConfig $response */ + $response = $uptimeCheckServiceClient->updateUptimeCheckConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_sync] diff --git a/owl-bot-staging/Monitoring/v3/src/V3/AlertPolicyServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/AlertPolicyServiceClient.php new file mode 100644 index 000000000000..66d3410ff0cb --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/AlertPolicyServiceClient.php @@ -0,0 +1,34 @@ + createAlertPolicyAsync(CreateAlertPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteAlertPolicyAsync(DeleteAlertPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAlertPolicyAsync(GetAlertPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAlertPoliciesAsync(ListAlertPoliciesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateAlertPolicyAsync(UpdateAlertPolicyRequest $request, array $optionalArgs = []) + */ +final class AlertPolicyServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.AlertPolicyService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/alert_policy_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/alert_policy_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/alert_policy_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/alert_policy_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a alert_policy + * resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted alert_policy resource. + */ + public static function alertPolicyName(string $project, string $alertPolicy): string + { + return self::getPathTemplate('alertPolicy')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * alert_policy_condition resource. + * + * @param string $project + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted alert_policy_condition resource. + */ + public static function alertPolicyConditionName(string $project, string $alertPolicy, string $condition): string + { + return self::getPathTemplate('alertPolicyCondition')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy resource. + * + * @param string $folder + * @param string $alertPolicy + * + * @return string The formatted folder_alert_policy resource. + */ + public static function folderAlertPolicyName(string $folder, string $alertPolicy): string + { + return self::getPathTemplate('folderAlertPolicy')->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy_condition resource. + * + * @param string $folder + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted folder_alert_policy_condition resource. + */ + public static function folderAlertPolicyConditionName(string $folder, string $alertPolicy, string $condition): string + { + return self::getPathTemplate('folderAlertPolicyCondition')->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy resource. + * + * @param string $organization + * @param string $alertPolicy + * + * @return string The formatted organization_alert_policy resource. + */ + public static function organizationAlertPolicyName(string $organization, string $alertPolicy): string + { + return self::getPathTemplate('organizationAlertPolicy')->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy_condition resource. + * + * @param string $organization + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted organization_alert_policy_condition resource. + */ + public static function organizationAlertPolicyConditionName(string $organization, string $alertPolicy, string $condition): string + { + return self::getPathTemplate('organizationAlertPolicyCondition')->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted project_alert_policy resource. + */ + public static function projectAlertPolicyName(string $project, string $alertPolicy): string + { + return self::getPathTemplate('projectAlertPolicy')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy_condition resource. + * + * @param string $project + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted project_alert_policy_condition resource. + */ + public static function projectAlertPolicyConditionName(string $project, string $alertPolicy, string $condition): string + { + return self::getPathTemplate('projectAlertPolicyCondition')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - alertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - alertPolicyCondition: projects/{project}/alertPolicies/{alert_policy}/conditions/{condition} + * - folderAlertPolicy: folders/{folder}/alertPolicies/{alert_policy} + * - folderAlertPolicyCondition: folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition} + * - organizationAlertPolicy: organizations/{organization}/alertPolicies/{alert_policy} + * - organizationAlertPolicyCondition: organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition} + * - projectAlertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - projectAlertPolicyCondition: projects/{project}/alertPolicies/{alert_policy}/conditions/{condition} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * The async variant is {@see AlertPolicyServiceClient::createAlertPolicyAsync()} . + * + * @example samples/V3/AlertPolicyServiceClient/create_alert_policy.php + * + * @param CreateAlertPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AlertPolicy + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAlertPolicy(CreateAlertPolicyRequest $request, array $callOptions = []): AlertPolicy + { + return $this->startApiCall('CreateAlertPolicy', $request, $callOptions)->wait(); + } + + /** + * Deletes an alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * The async variant is {@see AlertPolicyServiceClient::deleteAlertPolicyAsync()} . + * + * @example samples/V3/AlertPolicyServiceClient/delete_alert_policy.php + * + * @param DeleteAlertPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteAlertPolicy(DeleteAlertPolicyRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteAlertPolicy', $request, $callOptions)->wait(); + } + + /** + * Gets a single alerting policy. + * + * The async variant is {@see AlertPolicyServiceClient::getAlertPolicyAsync()} . + * + * @example samples/V3/AlertPolicyServiceClient/get_alert_policy.php + * + * @param GetAlertPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AlertPolicy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAlertPolicy(GetAlertPolicyRequest $request, array $callOptions = []): AlertPolicy + { + return $this->startApiCall('GetAlertPolicy', $request, $callOptions)->wait(); + } + + /** + * Lists the existing alerting policies for the workspace. + * + * The async variant is {@see AlertPolicyServiceClient::listAlertPoliciesAsync()} . + * + * @example samples/V3/AlertPolicyServiceClient/list_alert_policies.php + * + * @param ListAlertPoliciesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAlertPolicies(ListAlertPoliciesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAlertPolicies', $request, $callOptions); + } + + /** + * Updates an alerting policy. You can either replace the entire policy with + * a new one or replace only certain fields in the current alerting policy by + * specifying the fields to be updated via `updateMask`. Returns the + * updated alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * The async variant is {@see AlertPolicyServiceClient::updateAlertPolicyAsync()} . + * + * @example samples/V3/AlertPolicyServiceClient/update_alert_policy.php + * + * @param UpdateAlertPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AlertPolicy + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateAlertPolicy(UpdateAlertPolicyRequest $request, array $callOptions = []): AlertPolicy + { + return $this->startApiCall('UpdateAlertPolicy', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/GroupServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/GroupServiceClient.php new file mode 100644 index 000000000000..5300fa582fd7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/GroupServiceClient.php @@ -0,0 +1,448 @@ + createGroupAsync(CreateGroupRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteGroupAsync(DeleteGroupRequest $request, array $optionalArgs = []) + * @method PromiseInterface getGroupAsync(GetGroupRequest $request, array $optionalArgs = []) + * @method PromiseInterface listGroupMembersAsync(ListGroupMembersRequest $request, array $optionalArgs = []) + * @method PromiseInterface listGroupsAsync(ListGroupsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateGroupAsync(UpdateGroupRequest $request, array $optionalArgs = []) + */ +final class GroupServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.GroupService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/group_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/group_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/group_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/group_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder_group + * resource. + * + * @param string $folder + * @param string $group + * + * @return string The formatted folder_group resource. + */ + public static function folderGroupName(string $folder, string $group): string + { + return self::getPathTemplate('folderGroup')->render([ + 'folder' => $folder, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a group + * resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted group resource. + */ + public static function groupName(string $project, string $group): string + { + return self::getPathTemplate('group')->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_group resource. + * + * @param string $organization + * @param string $group + * + * @return string The formatted organization_group resource. + */ + public static function organizationGroupName(string $organization, string $group): string + { + return self::getPathTemplate('organizationGroup')->render([ + 'organization' => $organization, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_group resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted project_group resource. + */ + public static function projectGroupName(string $project, string $group): string + { + return self::getPathTemplate('projectGroup')->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderGroup: folders/{folder}/groups/{group} + * - group: projects/{project}/groups/{group} + * - organizationGroup: organizations/{organization}/groups/{group} + * - projectGroup: projects/{project}/groups/{group} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new group. + * + * The async variant is {@see GroupServiceClient::createGroupAsync()} . + * + * @example samples/V3/GroupServiceClient/create_group.php + * + * @param CreateGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Group + * + * @throws ApiException Thrown if the API call fails. + */ + public function createGroup(CreateGroupRequest $request, array $callOptions = []): Group + { + return $this->startApiCall('CreateGroup', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing group. + * + * The async variant is {@see GroupServiceClient::deleteGroupAsync()} . + * + * @example samples/V3/GroupServiceClient/delete_group.php + * + * @param DeleteGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteGroup(DeleteGroupRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteGroup', $request, $callOptions)->wait(); + } + + /** + * Gets a single group. + * + * The async variant is {@see GroupServiceClient::getGroupAsync()} . + * + * @example samples/V3/GroupServiceClient/get_group.php + * + * @param GetGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Group + * + * @throws ApiException Thrown if the API call fails. + */ + public function getGroup(GetGroupRequest $request, array $callOptions = []): Group + { + return $this->startApiCall('GetGroup', $request, $callOptions)->wait(); + } + + /** + * Lists the monitored resources that are members of a group. + * + * The async variant is {@see GroupServiceClient::listGroupMembersAsync()} . + * + * @example samples/V3/GroupServiceClient/list_group_members.php + * + * @param ListGroupMembersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listGroupMembers(ListGroupMembersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListGroupMembers', $request, $callOptions); + } + + /** + * Lists the existing groups. + * + * The async variant is {@see GroupServiceClient::listGroupsAsync()} . + * + * @example samples/V3/GroupServiceClient/list_groups.php + * + * @param ListGroupsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listGroups(ListGroupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListGroups', $request, $callOptions); + } + + /** + * Updates an existing group. + * You can change any group attributes except `name`. + * + * The async variant is {@see GroupServiceClient::updateGroupAsync()} . + * + * @example samples/V3/GroupServiceClient/update_group.php + * + * @param UpdateGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Group + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateGroup(UpdateGroupRequest $request, array $callOptions = []): Group + { + return $this->startApiCall('UpdateGroup', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/MetricServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/MetricServiceClient.php new file mode 100644 index 000000000000..543c25b8c7d1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/MetricServiceClient.php @@ -0,0 +1,679 @@ + createMetricDescriptorAsync(CreateMetricDescriptorRequest $request, array $optionalArgs = []) + * @method PromiseInterface createServiceTimeSeriesAsync(CreateTimeSeriesRequest $request, array $optionalArgs = []) + * @method PromiseInterface createTimeSeriesAsync(CreateTimeSeriesRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMetricDescriptorAsync(DeleteMetricDescriptorRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMetricDescriptorAsync(GetMetricDescriptorRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMonitoredResourceDescriptorAsync(GetMonitoredResourceDescriptorRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMetricDescriptorsAsync(ListMetricDescriptorsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMonitoredResourceDescriptorsAsync(ListMonitoredResourceDescriptorsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listTimeSeriesAsync(ListTimeSeriesRequest $request, array $optionalArgs = []) + */ +final class MetricServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.MetricService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + 'https://www.googleapis.com/auth/monitoring.write', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/metric_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/metric_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/metric_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/metric_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName(string $folder): string + { + return self::getPathTemplate('folder')->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_metric_descriptor resource. + * + * @param string $folder + * @param string $metricDescriptor + * + * @return string The formatted folder_metric_descriptor resource. + */ + public static function folderMetricDescriptorName(string $folder, string $metricDescriptor): string + { + return self::getPathTemplate('folderMetricDescriptor')->render([ + 'folder' => $folder, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_monitored_resource_descriptor resource. + * + * @param string $folder + * @param string $monitoredResourceDescriptor + * + * @return string The formatted folder_monitored_resource_descriptor resource. + */ + public static function folderMonitoredResourceDescriptorName(string $folder, string $monitoredResourceDescriptor): string + { + return self::getPathTemplate('folderMonitoredResourceDescriptor')->render([ + 'folder' => $folder, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metric_descriptor resource. + * + * @param string $project + * @param string $metricDescriptor + * + * @return string The formatted metric_descriptor resource. + */ + public static function metricDescriptorName(string $project, string $metricDescriptor): string + { + return self::getPathTemplate('metricDescriptor')->render([ + 'project' => $project, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * monitored_resource_descriptor resource. + * + * @param string $project + * @param string $monitoredResourceDescriptor + * + * @return string The formatted monitored_resource_descriptor resource. + */ + public static function monitoredResourceDescriptorName(string $project, string $monitoredResourceDescriptor): string + { + return self::getPathTemplate('monitoredResourceDescriptor')->render([ + 'project' => $project, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName(string $organization): string + { + return self::getPathTemplate('organization')->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_metric_descriptor resource. + * + * @param string $organization + * @param string $metricDescriptor + * + * @return string The formatted organization_metric_descriptor resource. + */ + public static function organizationMetricDescriptorName(string $organization, string $metricDescriptor): string + { + return self::getPathTemplate('organizationMetricDescriptor')->render([ + 'organization' => $organization, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_monitored_resource_descriptor resource. + * + * @param string $organization + * @param string $monitoredResourceDescriptor + * + * @return string The formatted organization_monitored_resource_descriptor resource. + */ + public static function organizationMonitoredResourceDescriptorName(string $organization, string $monitoredResourceDescriptor): string + { + return self::getPathTemplate('organizationMonitoredResourceDescriptor')->render([ + 'organization' => $organization, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_metric_descriptor resource. + * + * @param string $project + * @param string $metricDescriptor + * + * @return string The formatted project_metric_descriptor resource. + */ + public static function projectMetricDescriptorName(string $project, string $metricDescriptor): string + { + return self::getPathTemplate('projectMetricDescriptor')->render([ + 'project' => $project, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_monitored_resource_descriptor resource. + * + * @param string $project + * @param string $monitoredResourceDescriptor + * + * @return string The formatted project_monitored_resource_descriptor resource. + */ + public static function projectMonitoredResourceDescriptorName(string $project, string $monitoredResourceDescriptor): string + { + return self::getPathTemplate('projectMonitoredResourceDescriptor')->render([ + 'project' => $project, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * + * @return string The formatted workspace resource. + */ + public static function workspaceName(string $project): string + { + return self::getPathTemplate('workspace')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folder: folders/{folder} + * - folderMetricDescriptor: folders/{folder}/metricDescriptors/{metric_descriptor=**} + * - folderMonitoredResourceDescriptor: folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - metricDescriptor: projects/{project}/metricDescriptors/{metric_descriptor=**} + * - monitoredResourceDescriptor: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - organization: organizations/{organization} + * - organizationMetricDescriptor: organizations/{organization}/metricDescriptors/{metric_descriptor=**} + * - organizationMonitoredResourceDescriptor: organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - project: projects/{project} + * - projectMetricDescriptor: projects/{project}/metricDescriptors/{metric_descriptor=**} + * - projectMonitoredResourceDescriptor: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - workspace: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new metric descriptor. + * The creation is executed asynchronously. + * User-created metric descriptors define + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics). + * The metric descriptor is updated if it already exists, + * except that metric labels are never removed. + * + * The async variant is {@see MetricServiceClient::createMetricDescriptorAsync()} . + * + * @example samples/V3/MetricServiceClient/create_metric_descriptor.php + * + * @param CreateMetricDescriptorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MetricDescriptor + * + * @throws ApiException Thrown if the API call fails. + */ + public function createMetricDescriptor(CreateMetricDescriptorRequest $request, array $callOptions = []): MetricDescriptor + { + return $this->startApiCall('CreateMetricDescriptor', $request, $callOptions)->wait(); + } + + /** + * Creates or adds data to one or more service time series. A service time + * series is a time series for a metric from a Google Cloud service. The + * response is empty if all time series in the request were written. If any + * time series could not be written, a corresponding failure message is + * included in the error response. This endpoint rejects writes to + * user-defined metrics. + * This method is only for use by Google Cloud services. Use + * [projects.timeSeries.create][google.monitoring.v3.MetricService.CreateTimeSeries] + * instead. + * + * The async variant is {@see MetricServiceClient::createServiceTimeSeriesAsync()} + * . + * + * @example samples/V3/MetricServiceClient/create_service_time_series.php + * + * @param CreateTimeSeriesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function createServiceTimeSeries(CreateTimeSeriesRequest $request, array $callOptions = []): void + { + $this->startApiCall('CreateServiceTimeSeries', $request, $callOptions)->wait(); + } + + /** + * Creates or adds data to one or more time series. + * The response is empty if all time series in the request were written. + * If any time series could not be written, a corresponding failure message is + * included in the error response. + * This method does not support + * [resource locations constraint of an organization + * policy](https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy). + * + * The async variant is {@see MetricServiceClient::createTimeSeriesAsync()} . + * + * @example samples/V3/MetricServiceClient/create_time_series.php + * + * @param CreateTimeSeriesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function createTimeSeries(CreateTimeSeriesRequest $request, array $callOptions = []): void + { + $this->startApiCall('CreateTimeSeries', $request, $callOptions)->wait(); + } + + /** + * Deletes a metric descriptor. Only user-created + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be + * deleted. + * + * The async variant is {@see MetricServiceClient::deleteMetricDescriptorAsync()} . + * + * @example samples/V3/MetricServiceClient/delete_metric_descriptor.php + * + * @param DeleteMetricDescriptorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMetricDescriptor(DeleteMetricDescriptorRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteMetricDescriptor', $request, $callOptions)->wait(); + } + + /** + * Gets a single metric descriptor. + * + * The async variant is {@see MetricServiceClient::getMetricDescriptorAsync()} . + * + * @example samples/V3/MetricServiceClient/get_metric_descriptor.php + * + * @param GetMetricDescriptorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MetricDescriptor + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMetricDescriptor(GetMetricDescriptorRequest $request, array $callOptions = []): MetricDescriptor + { + return $this->startApiCall('GetMetricDescriptor', $request, $callOptions)->wait(); + } + + /** + * Gets a single monitored resource descriptor. + * + * The async variant is + * {@see MetricServiceClient::getMonitoredResourceDescriptorAsync()} . + * + * @example samples/V3/MetricServiceClient/get_monitored_resource_descriptor.php + * + * @param GetMonitoredResourceDescriptorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MonitoredResourceDescriptor + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest $request, array $callOptions = []): MonitoredResourceDescriptor + { + return $this->startApiCall('GetMonitoredResourceDescriptor', $request, $callOptions)->wait(); + } + + /** + * Lists metric descriptors that match a filter. + * + * The async variant is {@see MetricServiceClient::listMetricDescriptorsAsync()} . + * + * @example samples/V3/MetricServiceClient/list_metric_descriptors.php + * + * @param ListMetricDescriptorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMetricDescriptors(ListMetricDescriptorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMetricDescriptors', $request, $callOptions); + } + + /** + * Lists monitored resource descriptors that match a filter. + * + * The async variant is + * {@see MetricServiceClient::listMonitoredResourceDescriptorsAsync()} . + * + * @example samples/V3/MetricServiceClient/list_monitored_resource_descriptors.php + * + * @param ListMonitoredResourceDescriptorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMonitoredResourceDescriptors', $request, $callOptions); + } + + /** + * Lists time series that match a filter. + * + * The async variant is {@see MetricServiceClient::listTimeSeriesAsync()} . + * + * @example samples/V3/MetricServiceClient/list_time_series.php + * + * @param ListTimeSeriesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTimeSeries(ListTimeSeriesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTimeSeries', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/NotificationChannelServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/NotificationChannelServiceClient.php new file mode 100644 index 000000000000..581afdc21244 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/NotificationChannelServiceClient.php @@ -0,0 +1,683 @@ + createNotificationChannelAsync(CreateNotificationChannelRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteNotificationChannelAsync(DeleteNotificationChannelRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNotificationChannelAsync(GetNotificationChannelRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNotificationChannelDescriptorAsync(GetNotificationChannelDescriptorRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNotificationChannelVerificationCodeAsync(GetNotificationChannelVerificationCodeRequest $request, array $optionalArgs = []) + * @method PromiseInterface listNotificationChannelDescriptorsAsync(ListNotificationChannelDescriptorsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listNotificationChannelsAsync(ListNotificationChannelsRequest $request, array $optionalArgs = []) + * @method PromiseInterface sendNotificationChannelVerificationCodeAsync(SendNotificationChannelVerificationCodeRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateNotificationChannelAsync(UpdateNotificationChannelRequest $request, array $optionalArgs = []) + * @method PromiseInterface verifyNotificationChannelAsync(VerifyNotificationChannelRequest $request, array $optionalArgs = []) + */ +final class NotificationChannelServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.NotificationChannelService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/notification_channel_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/notification_channel_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/notification_channel_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/notification_channel_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_channel_descriptor resource. + * + * @param string $folder + * @param string $channelDescriptor + * + * @return string The formatted folder_channel_descriptor resource. + */ + public static function folderChannelDescriptorName(string $folder, string $channelDescriptor): string + { + return self::getPathTemplate('folderChannelDescriptor')->render([ + 'folder' => $folder, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_notification_channel resource. + * + * @param string $folder + * @param string $notificationChannel + * + * @return string The formatted folder_notification_channel resource. + */ + public static function folderNotificationChannelName(string $folder, string $notificationChannel): string + { + return self::getPathTemplate('folderNotificationChannel')->render([ + 'folder' => $folder, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * notification_channel resource. + * + * @param string $project + * @param string $notificationChannel + * + * @return string The formatted notification_channel resource. + */ + public static function notificationChannelName(string $project, string $notificationChannel): string + { + return self::getPathTemplate('notificationChannel')->render([ + 'project' => $project, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * notification_channel_descriptor resource. + * + * @param string $project + * @param string $channelDescriptor + * + * @return string The formatted notification_channel_descriptor resource. + */ + public static function notificationChannelDescriptorName(string $project, string $channelDescriptor): string + { + return self::getPathTemplate('notificationChannelDescriptor')->render([ + 'project' => $project, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_channel_descriptor resource. + * + * @param string $organization + * @param string $channelDescriptor + * + * @return string The formatted organization_channel_descriptor resource. + */ + public static function organizationChannelDescriptorName(string $organization, string $channelDescriptor): string + { + return self::getPathTemplate('organizationChannelDescriptor')->render([ + 'organization' => $organization, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_notification_channel resource. + * + * @param string $organization + * @param string $notificationChannel + * + * @return string The formatted organization_notification_channel resource. + */ + public static function organizationNotificationChannelName(string $organization, string $notificationChannel): string + { + return self::getPathTemplate('organizationNotificationChannel')->render([ + 'organization' => $organization, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_channel_descriptor resource. + * + * @param string $project + * @param string $channelDescriptor + * + * @return string The formatted project_channel_descriptor resource. + */ + public static function projectChannelDescriptorName(string $project, string $channelDescriptor): string + { + return self::getPathTemplate('projectChannelDescriptor')->render([ + 'project' => $project, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_notification_channel resource. + * + * @param string $project + * @param string $notificationChannel + * + * @return string The formatted project_notification_channel resource. + */ + public static function projectNotificationChannelName(string $project, string $notificationChannel): string + { + return self::getPathTemplate('projectNotificationChannel')->render([ + 'project' => $project, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderChannelDescriptor: folders/{folder}/notificationChannelDescriptors/{channel_descriptor} + * - folderNotificationChannel: folders/{folder}/notificationChannels/{notification_channel} + * - notificationChannel: projects/{project}/notificationChannels/{notification_channel} + * - notificationChannelDescriptor: projects/{project}/notificationChannelDescriptors/{channel_descriptor} + * - organizationChannelDescriptor: organizations/{organization}/notificationChannelDescriptors/{channel_descriptor} + * - organizationNotificationChannel: organizations/{organization}/notificationChannels/{notification_channel} + * - projectChannelDescriptor: projects/{project}/notificationChannelDescriptors/{channel_descriptor} + * - projectNotificationChannel: projects/{project}/notificationChannels/{notification_channel} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new notification channel, representing a single notification + * endpoint such as an email address, SMS number, or PagerDuty service. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * The async variant is + * {@see NotificationChannelServiceClient::createNotificationChannelAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/create_notification_channel.php + * + * @param CreateNotificationChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationChannel + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNotificationChannel(CreateNotificationChannelRequest $request, array $callOptions = []): NotificationChannel + { + return $this->startApiCall('CreateNotificationChannel', $request, $callOptions)->wait(); + } + + /** + * Deletes a notification channel. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * The async variant is + * {@see NotificationChannelServiceClient::deleteNotificationChannelAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/delete_notification_channel.php + * + * @param DeleteNotificationChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteNotificationChannel(DeleteNotificationChannelRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteNotificationChannel', $request, $callOptions)->wait(); + } + + /** + * Gets a single notification channel. The channel includes the relevant + * configuration details with which the channel was created. However, the + * response may truncate or omit passwords, API keys, or other private key + * matter and thus the response may not be 100% identical to the information + * that was supplied in the call to the create method. + * + * The async variant is + * {@see NotificationChannelServiceClient::getNotificationChannelAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/get_notification_channel.php + * + * @param GetNotificationChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationChannel + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNotificationChannel(GetNotificationChannelRequest $request, array $callOptions = []): NotificationChannel + { + return $this->startApiCall('GetNotificationChannel', $request, $callOptions)->wait(); + } + + /** + * Gets a single channel descriptor. The descriptor indicates which fields + * are expected / permitted for a notification channel of the given type. + * + * The async variant is + * {@see NotificationChannelServiceClient::getNotificationChannelDescriptorAsync()} + * . + * + * @example samples/V3/NotificationChannelServiceClient/get_notification_channel_descriptor.php + * + * @param GetNotificationChannelDescriptorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationChannelDescriptor + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest $request, array $callOptions = []): NotificationChannelDescriptor + { + return $this->startApiCall('GetNotificationChannelDescriptor', $request, $callOptions)->wait(); + } + + /** + * Requests a verification code for an already verified channel that can then + * be used in a call to VerifyNotificationChannel() on a different channel + * with an equivalent identity in the same or in a different project. This + * makes it possible to copy a channel between projects without requiring + * manual reverification of the channel. If the channel is not in the + * verified state, this method will fail (in other words, this may only be + * used if the SendNotificationChannelVerificationCode and + * VerifyNotificationChannel paths have already been used to put the given + * channel into the verified state). + * + * There is no guarantee that the verification codes returned by this method + * will be of a similar structure or form as the ones that are delivered + * to the channel via SendNotificationChannelVerificationCode; while + * VerifyNotificationChannel() will recognize both the codes delivered via + * SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that + * the verification codes delivered via + * SendNotificationChannelVerificationCode() will be shorter and also + * have a shorter expiration (e.g. codes such as "G-123456") whereas + * GetVerificationCode() will typically return a much longer, websafe base + * 64 encoded string that has a longer expiration time. + * + * The async variant is + * {@see NotificationChannelServiceClient::getNotificationChannelVerificationCodeAsync()} + * . + * + * @example samples/V3/NotificationChannelServiceClient/get_notification_channel_verification_code.php + * + * @param GetNotificationChannelVerificationCodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GetNotificationChannelVerificationCodeResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest $request, array $callOptions = []): GetNotificationChannelVerificationCodeResponse + { + return $this->startApiCall('GetNotificationChannelVerificationCode', $request, $callOptions)->wait(); + } + + /** + * Lists the descriptors for supported channel types. The use of descriptors + * makes it possible for new channel types to be dynamically added. + * + * The async variant is + * {@see NotificationChannelServiceClient::listNotificationChannelDescriptorsAsync()} + * . + * + * @example samples/V3/NotificationChannelServiceClient/list_notification_channel_descriptors.php + * + * @param ListNotificationChannelDescriptorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNotificationChannelDescriptors', $request, $callOptions); + } + + /** + * Lists the notification channels that have been created for the project. + * To list the types of notification channels that are supported, use + * the `ListNotificationChannelDescriptors` method. + * + * The async variant is + * {@see NotificationChannelServiceClient::listNotificationChannelsAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/list_notification_channels.php + * + * @param ListNotificationChannelsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNotificationChannels(ListNotificationChannelsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNotificationChannels', $request, $callOptions); + } + + /** + * Causes a verification code to be delivered to the channel. The code + * can then be supplied in `VerifyNotificationChannel` to verify the channel. + * + * The async variant is + * {@see NotificationChannelServiceClient::sendNotificationChannelVerificationCodeAsync()} + * . + * + * @example samples/V3/NotificationChannelServiceClient/send_notification_channel_verification_code.php + * + * @param SendNotificationChannelVerificationCodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function sendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest $request, array $callOptions = []): void + { + $this->startApiCall('SendNotificationChannelVerificationCode', $request, $callOptions)->wait(); + } + + /** + * Updates a notification channel. Fields not specified in the field mask + * remain unchanged. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * The async variant is + * {@see NotificationChannelServiceClient::updateNotificationChannelAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/update_notification_channel.php + * + * @param UpdateNotificationChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationChannel + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNotificationChannel(UpdateNotificationChannelRequest $request, array $callOptions = []): NotificationChannel + { + return $this->startApiCall('UpdateNotificationChannel', $request, $callOptions)->wait(); + } + + /** + * Verifies a `NotificationChannel` by proving receipt of the code + * delivered to the channel as a result of calling + * `SendNotificationChannelVerificationCode`. + * + * The async variant is + * {@see NotificationChannelServiceClient::verifyNotificationChannelAsync()} . + * + * @example samples/V3/NotificationChannelServiceClient/verify_notification_channel.php + * + * @param VerifyNotificationChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationChannel + * + * @throws ApiException Thrown if the API call fails. + */ + public function verifyNotificationChannel(VerifyNotificationChannelRequest $request, array $callOptions = []): NotificationChannel + { + return $this->startApiCall('VerifyNotificationChannel', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/QueryServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/QueryServiceClient.php new file mode 100644 index 000000000000..25672dfd529d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/QueryServiceClient.php @@ -0,0 +1,202 @@ + queryTimeSeriesAsync(QueryTimeSeriesRequest $request, array $optionalArgs = []) + */ +final class QueryServiceClient +{ + use GapicClientTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.QueryService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/query_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/query_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/query_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/query_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Queries time series by using Monitoring Query Language (MQL). We recommend + * using PromQL instead of MQL. For more information about the status of MQL, + * see the [MQL deprecation + * notice](https://cloud.google.com/stackdriver/docs/deprecations/mql). + * + * The async variant is {@see QueryServiceClient::queryTimeSeriesAsync()} . + * + * @example samples/V3/QueryServiceClient/query_time_series.php + * + * @param QueryTimeSeriesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @deprecated This method will be removed in the next major version update. + */ + public function queryTimeSeries(QueryTimeSeriesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('QueryTimeSeries', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/ServiceMonitoringServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/ServiceMonitoringServiceClient.php new file mode 100644 index 000000000000..202598491b2c --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/ServiceMonitoringServiceClient.php @@ -0,0 +1,639 @@ + createServiceAsync(CreateServiceRequest $request, array $optionalArgs = []) + * @method PromiseInterface createServiceLevelObjectiveAsync(CreateServiceLevelObjectiveRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteServiceAsync(DeleteServiceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteServiceLevelObjectiveAsync(DeleteServiceLevelObjectiveRequest $request, array $optionalArgs = []) + * @method PromiseInterface getServiceAsync(GetServiceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getServiceLevelObjectiveAsync(GetServiceLevelObjectiveRequest $request, array $optionalArgs = []) + * @method PromiseInterface listServiceLevelObjectivesAsync(ListServiceLevelObjectivesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listServicesAsync(ListServicesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateServiceAsync(UpdateServiceRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateServiceLevelObjectiveAsync(UpdateServiceLevelObjectiveRequest $request, array $optionalArgs = []) + */ +final class ServiceMonitoringServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.ServiceMonitoringService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/service_monitoring_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/service_monitoring_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/service_monitoring_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/service_monitoring_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_service resource. + * + * @param string $folder + * @param string $service + * + * @return string The formatted folder_service resource. + */ + public static function folderServiceName(string $folder, string $service): string + { + return self::getPathTemplate('folderService')->render([ + 'folder' => $folder, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_service_service_level_objective resource. + * + * @param string $folder + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted folder_service_service_level_objective resource. + */ + public static function folderServiceServiceLevelObjectiveName(string $folder, string $service, string $serviceLevelObjective): string + { + return self::getPathTemplate('folderServiceServiceLevelObjective')->render([ + 'folder' => $folder, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_service resource. + * + * @param string $organization + * @param string $service + * + * @return string The formatted organization_service resource. + */ + public static function organizationServiceName(string $organization, string $service): string + { + return self::getPathTemplate('organizationService')->render([ + 'organization' => $organization, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_service_service_level_objective resource. + * + * @param string $organization + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted organization_service_service_level_objective resource. + */ + public static function organizationServiceServiceLevelObjectiveName(string $organization, string $service, string $serviceLevelObjective): string + { + return self::getPathTemplate('organizationServiceServiceLevelObjective')->render([ + 'organization' => $organization, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_service resource. + * + * @param string $project + * @param string $service + * + * @return string The formatted project_service resource. + */ + public static function projectServiceName(string $project, string $service): string + { + return self::getPathTemplate('projectService')->render([ + 'project' => $project, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_service_service_level_objective resource. + * + * @param string $project + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted project_service_service_level_objective resource. + */ + public static function projectServiceServiceLevelObjectiveName(string $project, string $service, string $serviceLevelObjective): string + { + return self::getPathTemplate('projectServiceServiceLevelObjective')->render([ + 'project' => $project, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * service_level_objective resource. + * + * @param string $project + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted service_level_objective resource. + */ + public static function serviceLevelObjectiveName(string $project, string $service, string $serviceLevelObjective): string + { + return self::getPathTemplate('serviceLevelObjective')->render([ + 'project' => $project, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderService: folders/{folder}/services/{service} + * - folderServiceServiceLevelObjective: folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - organizationService: organizations/{organization}/services/{service} + * - organizationServiceServiceLevelObjective: organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - projectService: projects/{project}/services/{service} + * - projectServiceServiceLevelObjective: projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - service: projects/{project}/services/{service} + * - serviceLevelObjective: projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Create a `Service`. + * + * The async variant is {@see ServiceMonitoringServiceClient::createServiceAsync()} + * . + * + * @example samples/V3/ServiceMonitoringServiceClient/create_service.php + * + * @param CreateServiceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Service + * + * @throws ApiException Thrown if the API call fails. + */ + public function createService(CreateServiceRequest $request, array $callOptions = []): Service + { + return $this->startApiCall('CreateService', $request, $callOptions)->wait(); + } + + /** + * Create a `ServiceLevelObjective` for the given `Service`. + * + * The async variant is + * {@see ServiceMonitoringServiceClient::createServiceLevelObjectiveAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/create_service_level_objective.php + * + * @param CreateServiceLevelObjectiveRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ServiceLevelObjective + * + * @throws ApiException Thrown if the API call fails. + */ + public function createServiceLevelObjective(CreateServiceLevelObjectiveRequest $request, array $callOptions = []): ServiceLevelObjective + { + return $this->startApiCall('CreateServiceLevelObjective', $request, $callOptions)->wait(); + } + + /** + * Soft delete this `Service`. + * + * The async variant is {@see ServiceMonitoringServiceClient::deleteServiceAsync()} + * . + * + * @example samples/V3/ServiceMonitoringServiceClient/delete_service.php + * + * @param DeleteServiceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteService(DeleteServiceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteService', $request, $callOptions)->wait(); + } + + /** + * Delete the given `ServiceLevelObjective`. + * + * The async variant is + * {@see ServiceMonitoringServiceClient::deleteServiceLevelObjectiveAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/delete_service_level_objective.php + * + * @param DeleteServiceLevelObjectiveRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteServiceLevelObjective', $request, $callOptions)->wait(); + } + + /** + * Get the named `Service`. + * + * The async variant is {@see ServiceMonitoringServiceClient::getServiceAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/get_service.php + * + * @param GetServiceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Service + * + * @throws ApiException Thrown if the API call fails. + */ + public function getService(GetServiceRequest $request, array $callOptions = []): Service + { + return $this->startApiCall('GetService', $request, $callOptions)->wait(); + } + + /** + * Get a `ServiceLevelObjective` by name. + * + * The async variant is + * {@see ServiceMonitoringServiceClient::getServiceLevelObjectiveAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/get_service_level_objective.php + * + * @param GetServiceLevelObjectiveRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ServiceLevelObjective + * + * @throws ApiException Thrown if the API call fails. + */ + public function getServiceLevelObjective(GetServiceLevelObjectiveRequest $request, array $callOptions = []): ServiceLevelObjective + { + return $this->startApiCall('GetServiceLevelObjective', $request, $callOptions)->wait(); + } + + /** + * List the `ServiceLevelObjective`s for the given `Service`. + * + * The async variant is + * {@see ServiceMonitoringServiceClient::listServiceLevelObjectivesAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/list_service_level_objectives.php + * + * @param ListServiceLevelObjectivesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listServiceLevelObjectives(ListServiceLevelObjectivesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListServiceLevelObjectives', $request, $callOptions); + } + + /** + * List `Service`s for this Metrics Scope. + * + * The async variant is {@see ServiceMonitoringServiceClient::listServicesAsync()} + * . + * + * @example samples/V3/ServiceMonitoringServiceClient/list_services.php + * + * @param ListServicesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listServices(ListServicesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListServices', $request, $callOptions); + } + + /** + * Update this `Service`. + * + * The async variant is {@see ServiceMonitoringServiceClient::updateServiceAsync()} + * . + * + * @example samples/V3/ServiceMonitoringServiceClient/update_service.php + * + * @param UpdateServiceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Service + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateService(UpdateServiceRequest $request, array $callOptions = []): Service + { + return $this->startApiCall('UpdateService', $request, $callOptions)->wait(); + } + + /** + * Update the given `ServiceLevelObjective`. + * + * The async variant is + * {@see ServiceMonitoringServiceClient::updateServiceLevelObjectiveAsync()} . + * + * @example samples/V3/ServiceMonitoringServiceClient/update_service_level_objective.php + * + * @param UpdateServiceLevelObjectiveRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ServiceLevelObjective + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateServiceLevelObjective(UpdateServiceLevelObjectiveRequest $request, array $callOptions = []): ServiceLevelObjective + { + return $this->startApiCall('UpdateServiceLevelObjective', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/SnoozeServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/SnoozeServiceClient.php new file mode 100644 index 000000000000..9c00f00b9cbe --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/SnoozeServiceClient.php @@ -0,0 +1,438 @@ + createSnoozeAsync(CreateSnoozeRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSnoozeAsync(GetSnoozeRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSnoozesAsync(ListSnoozesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSnoozeAsync(UpdateSnoozeRequest $request, array $optionalArgs = []) + */ +final class SnoozeServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.SnoozeService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/snooze_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/snooze_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/snooze_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/snooze_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a alert_policy + * resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted alert_policy resource. + */ + public static function alertPolicyName(string $project, string $alertPolicy): string + { + return self::getPathTemplate('alertPolicy')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy resource. + * + * @param string $folder + * @param string $alertPolicy + * + * @return string The formatted folder_alert_policy resource. + */ + public static function folderAlertPolicyName(string $folder, string $alertPolicy): string + { + return self::getPathTemplate('folderAlertPolicy')->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy resource. + * + * @param string $organization + * @param string $alertPolicy + * + * @return string The formatted organization_alert_policy resource. + */ + public static function organizationAlertPolicyName(string $organization, string $alertPolicy): string + { + return self::getPathTemplate('organizationAlertPolicy')->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted project_alert_policy resource. + */ + public static function projectAlertPolicyName(string $project, string $alertPolicy): string + { + return self::getPathTemplate('projectAlertPolicy')->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a snooze + * resource. + * + * @param string $project + * @param string $snooze + * + * @return string The formatted snooze resource. + */ + public static function snoozeName(string $project, string $snooze): string + { + return self::getPathTemplate('snooze')->render([ + 'project' => $project, + 'snooze' => $snooze, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * + * @return string The formatted workspace resource. + */ + public static function workspaceName(string $project): string + { + return self::getPathTemplate('workspace')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - alertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - folderAlertPolicy: folders/{folder}/alertPolicies/{alert_policy} + * - organizationAlertPolicy: organizations/{organization}/alertPolicies/{alert_policy} + * - project: projects/{project} + * - projectAlertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - snooze: projects/{project}/snoozes/{snooze} + * - workspace: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a `Snooze` that will prevent alerts, which match the provided + * criteria, from being opened. The `Snooze` applies for a specific time + * interval. + * + * The async variant is {@see SnoozeServiceClient::createSnoozeAsync()} . + * + * @example samples/V3/SnoozeServiceClient/create_snooze.php + * + * @param CreateSnoozeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snooze + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSnooze(CreateSnoozeRequest $request, array $callOptions = []): Snooze + { + return $this->startApiCall('CreateSnooze', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `Snooze` by `name`. + * + * The async variant is {@see SnoozeServiceClient::getSnoozeAsync()} . + * + * @example samples/V3/SnoozeServiceClient/get_snooze.php + * + * @param GetSnoozeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snooze + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSnooze(GetSnoozeRequest $request, array $callOptions = []): Snooze + { + return $this->startApiCall('GetSnooze', $request, $callOptions)->wait(); + } + + /** + * Lists the `Snooze`s associated with a project. Can optionally pass in + * `filter`, which specifies predicates to match `Snooze`s. + * + * The async variant is {@see SnoozeServiceClient::listSnoozesAsync()} . + * + * @example samples/V3/SnoozeServiceClient/list_snoozes.php + * + * @param ListSnoozesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSnoozes(ListSnoozesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSnoozes', $request, $callOptions); + } + + /** + * Updates a `Snooze`, identified by its `name`, with the parameters in the + * given `Snooze` object. + * + * The async variant is {@see SnoozeServiceClient::updateSnoozeAsync()} . + * + * @example samples/V3/SnoozeServiceClient/update_snooze.php + * + * @param UpdateSnoozeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Snooze + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSnooze(UpdateSnoozeRequest $request, array $callOptions = []): Snooze + { + return $this->startApiCall('UpdateSnooze', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Client/UptimeCheckServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Client/UptimeCheckServiceClient.php new file mode 100644 index 000000000000..b5fe1271a61f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Client/UptimeCheckServiceClient.php @@ -0,0 +1,475 @@ + createUptimeCheckConfigAsync(CreateUptimeCheckConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteUptimeCheckConfigAsync(DeleteUptimeCheckConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getUptimeCheckConfigAsync(GetUptimeCheckConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface listUptimeCheckConfigsAsync(ListUptimeCheckConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listUptimeCheckIpsAsync(ListUptimeCheckIpsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateUptimeCheckConfigAsync(UpdateUptimeCheckConfigRequest $request, array $optionalArgs = []) + */ +final class UptimeCheckServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.monitoring.v3.UptimeCheckService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/uptime_check_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/uptime_check_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/uptime_check_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/uptime_check_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_uptime_check_config resource. + * + * @param string $folder + * @param string $uptimeCheckConfig + * + * @return string The formatted folder_uptime_check_config resource. + */ + public static function folderUptimeCheckConfigName(string $folder, string $uptimeCheckConfig): string + { + return self::getPathTemplate('folderUptimeCheckConfig')->render([ + 'folder' => $folder, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName(string $project, string $location, string $function): string + { + return self::getPathTemplate('function')->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_uptime_check_config resource. + * + * @param string $organization + * @param string $uptimeCheckConfig + * + * @return string The formatted organization_uptime_check_config resource. + */ + public static function organizationUptimeCheckConfigName(string $organization, string $uptimeCheckConfig): string + { + return self::getPathTemplate('organizationUptimeCheckConfig')->render([ + 'organization' => $organization, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_uptime_check_config resource. + * + * @param string $project + * @param string $uptimeCheckConfig + * + * @return string The formatted project_uptime_check_config resource. + */ + public static function projectUptimeCheckConfigName(string $project, string $uptimeCheckConfig): string + { + return self::getPathTemplate('projectUptimeCheckConfig')->render([ + 'project' => $project, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * uptime_check_config resource. + * + * @param string $project + * @param string $uptimeCheckConfig + * + * @return string The formatted uptime_check_config resource. + */ + public static function uptimeCheckConfigName(string $project, string $uptimeCheckConfig): string + { + return self::getPathTemplate('uptimeCheckConfig')->render([ + 'project' => $project, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderUptimeCheckConfig: folders/{folder}/uptimeCheckConfigs/{uptime_check_config} + * - function: projects/{project}/locations/{location}/functions/{function} + * - organizationUptimeCheckConfig: organizations/{organization}/uptimeCheckConfigs/{uptime_check_config} + * - projectUptimeCheckConfig: projects/{project}/uptimeCheckConfigs/{uptime_check_config} + * - uptimeCheckConfig: projects/{project}/uptimeCheckConfigs/{uptime_check_config} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new Uptime check configuration. + * + * The async variant is + * {@see UptimeCheckServiceClient::createUptimeCheckConfigAsync()} . + * + * @example samples/V3/UptimeCheckServiceClient/create_uptime_check_config.php + * + * @param CreateUptimeCheckConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return UptimeCheckConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function createUptimeCheckConfig(CreateUptimeCheckConfigRequest $request, array $callOptions = []): UptimeCheckConfig + { + return $this->startApiCall('CreateUptimeCheckConfig', $request, $callOptions)->wait(); + } + + /** + * Deletes an Uptime check configuration. Note that this method will fail + * if the Uptime check configuration is referenced by an alert policy or + * other dependent configs that would be rendered invalid by the deletion. + * + * The async variant is + * {@see UptimeCheckServiceClient::deleteUptimeCheckConfigAsync()} . + * + * @example samples/V3/UptimeCheckServiceClient/delete_uptime_check_config.php + * + * @param DeleteUptimeCheckConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteUptimeCheckConfig', $request, $callOptions)->wait(); + } + + /** + * Gets a single Uptime check configuration. + * + * The async variant is + * {@see UptimeCheckServiceClient::getUptimeCheckConfigAsync()} . + * + * @example samples/V3/UptimeCheckServiceClient/get_uptime_check_config.php + * + * @param GetUptimeCheckConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return UptimeCheckConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getUptimeCheckConfig(GetUptimeCheckConfigRequest $request, array $callOptions = []): UptimeCheckConfig + { + return $this->startApiCall('GetUptimeCheckConfig', $request, $callOptions)->wait(); + } + + /** + * Lists the existing valid Uptime check configurations for the project + * (leaving out any invalid configurations). + * + * The async variant is + * {@see UptimeCheckServiceClient::listUptimeCheckConfigsAsync()} . + * + * @example samples/V3/UptimeCheckServiceClient/list_uptime_check_configs.php + * + * @param ListUptimeCheckConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listUptimeCheckConfigs(ListUptimeCheckConfigsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListUptimeCheckConfigs', $request, $callOptions); + } + + /** + * Returns the list of IP addresses that checkers run from. + * + * The async variant is {@see UptimeCheckServiceClient::listUptimeCheckIpsAsync()} + * . + * + * @example samples/V3/UptimeCheckServiceClient/list_uptime_check_ips.php + * + * @param ListUptimeCheckIpsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listUptimeCheckIps(ListUptimeCheckIpsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListUptimeCheckIps', $request, $callOptions); + } + + /** + * Updates an Uptime check configuration. You can either replace the entire + * configuration with a new one or replace only certain fields in the current + * configuration by specifying the fields to be updated via `updateMask`. + * Returns the updated configuration. + * + * The async variant is + * {@see UptimeCheckServiceClient::updateUptimeCheckConfigAsync()} . + * + * @example samples/V3/UptimeCheckServiceClient/update_uptime_check_config.php + * + * @param UpdateUptimeCheckConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return UptimeCheckConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest $request, array $callOptions = []): UptimeCheckConfig + { + return $this->startApiCall('UpdateUptimeCheckConfig', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/AlertPolicyServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/AlertPolicyServiceGapicClient.php new file mode 100644 index 000000000000..b45a031630d8 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/AlertPolicyServiceGapicClient.php @@ -0,0 +1,806 @@ +createAlertPolicy($name, $alertPolicy); + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\AlertPolicyServiceClient}. + */ +class AlertPolicyServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.AlertPolicyService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $alertPolicyNameTemplate; + + private static $alertPolicyConditionNameTemplate; + + private static $folderAlertPolicyNameTemplate; + + private static $folderAlertPolicyConditionNameTemplate; + + private static $organizationAlertPolicyNameTemplate; + + private static $organizationAlertPolicyConditionNameTemplate; + + private static $projectAlertPolicyNameTemplate; + + private static $projectAlertPolicyConditionNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/alert_policy_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/alert_policy_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/alert_policy_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/alert_policy_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getAlertPolicyNameTemplate() + { + if (self::$alertPolicyNameTemplate == null) { + self::$alertPolicyNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}'); + } + + return self::$alertPolicyNameTemplate; + } + + private static function getAlertPolicyConditionNameTemplate() + { + if (self::$alertPolicyConditionNameTemplate == null) { + self::$alertPolicyConditionNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}'); + } + + return self::$alertPolicyConditionNameTemplate; + } + + private static function getFolderAlertPolicyNameTemplate() + { + if (self::$folderAlertPolicyNameTemplate == null) { + self::$folderAlertPolicyNameTemplate = new PathTemplate('folders/{folder}/alertPolicies/{alert_policy}'); + } + + return self::$folderAlertPolicyNameTemplate; + } + + private static function getFolderAlertPolicyConditionNameTemplate() + { + if (self::$folderAlertPolicyConditionNameTemplate == null) { + self::$folderAlertPolicyConditionNameTemplate = new PathTemplate('folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}'); + } + + return self::$folderAlertPolicyConditionNameTemplate; + } + + private static function getOrganizationAlertPolicyNameTemplate() + { + if (self::$organizationAlertPolicyNameTemplate == null) { + self::$organizationAlertPolicyNameTemplate = new PathTemplate('organizations/{organization}/alertPolicies/{alert_policy}'); + } + + return self::$organizationAlertPolicyNameTemplate; + } + + private static function getOrganizationAlertPolicyConditionNameTemplate() + { + if (self::$organizationAlertPolicyConditionNameTemplate == null) { + self::$organizationAlertPolicyConditionNameTemplate = new PathTemplate('organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}'); + } + + return self::$organizationAlertPolicyConditionNameTemplate; + } + + private static function getProjectAlertPolicyNameTemplate() + { + if (self::$projectAlertPolicyNameTemplate == null) { + self::$projectAlertPolicyNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}'); + } + + return self::$projectAlertPolicyNameTemplate; + } + + private static function getProjectAlertPolicyConditionNameTemplate() + { + if (self::$projectAlertPolicyConditionNameTemplate == null) { + self::$projectAlertPolicyConditionNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}'); + } + + return self::$projectAlertPolicyConditionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'alertPolicy' => self::getAlertPolicyNameTemplate(), + 'alertPolicyCondition' => self::getAlertPolicyConditionNameTemplate(), + 'folderAlertPolicy' => self::getFolderAlertPolicyNameTemplate(), + 'folderAlertPolicyCondition' => self::getFolderAlertPolicyConditionNameTemplate(), + 'organizationAlertPolicy' => self::getOrganizationAlertPolicyNameTemplate(), + 'organizationAlertPolicyCondition' => self::getOrganizationAlertPolicyConditionNameTemplate(), + 'projectAlertPolicy' => self::getProjectAlertPolicyNameTemplate(), + 'projectAlertPolicyCondition' => self::getProjectAlertPolicyConditionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a alert_policy + * resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted alert_policy resource. + */ + public static function alertPolicyName($project, $alertPolicy) + { + return self::getAlertPolicyNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * alert_policy_condition resource. + * + * @param string $project + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted alert_policy_condition resource. + */ + public static function alertPolicyConditionName($project, $alertPolicy, $condition) + { + return self::getAlertPolicyConditionNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy resource. + * + * @param string $folder + * @param string $alertPolicy + * + * @return string The formatted folder_alert_policy resource. + */ + public static function folderAlertPolicyName($folder, $alertPolicy) + { + return self::getFolderAlertPolicyNameTemplate()->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy_condition resource. + * + * @param string $folder + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted folder_alert_policy_condition resource. + */ + public static function folderAlertPolicyConditionName($folder, $alertPolicy, $condition) + { + return self::getFolderAlertPolicyConditionNameTemplate()->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy resource. + * + * @param string $organization + * @param string $alertPolicy + * + * @return string The formatted organization_alert_policy resource. + */ + public static function organizationAlertPolicyName($organization, $alertPolicy) + { + return self::getOrganizationAlertPolicyNameTemplate()->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy_condition resource. + * + * @param string $organization + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted organization_alert_policy_condition resource. + */ + public static function organizationAlertPolicyConditionName($organization, $alertPolicy, $condition) + { + return self::getOrganizationAlertPolicyConditionNameTemplate()->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted project_alert_policy resource. + */ + public static function projectAlertPolicyName($project, $alertPolicy) + { + return self::getProjectAlertPolicyNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy_condition resource. + * + * @param string $project + * @param string $alertPolicy + * @param string $condition + * + * @return string The formatted project_alert_policy_condition resource. + */ + public static function projectAlertPolicyConditionName($project, $alertPolicy, $condition) + { + return self::getProjectAlertPolicyConditionNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + 'condition' => $condition, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - alertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - alertPolicyCondition: projects/{project}/alertPolicies/{alert_policy}/conditions/{condition} + * - folderAlertPolicy: folders/{folder}/alertPolicies/{alert_policy} + * - folderAlertPolicyCondition: folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition} + * - organizationAlertPolicy: organizations/{organization}/alertPolicies/{alert_policy} + * - organizationAlertPolicyCondition: organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition} + * - projectAlertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - projectAlertPolicyCondition: projects/{project}/alertPolicies/{alert_policy}/conditions/{condition} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * Sample code: + * ``` + * $alertPolicyServiceClient = new AlertPolicyServiceClient(); + * try { + * $name = 'name'; + * $alertPolicy = new AlertPolicy(); + * $response = $alertPolicyServiceClient->createAlertPolicy($name, $alertPolicy); + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * @param AlertPolicy $alertPolicy Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\AlertPolicy + * + * @throws ApiException if the remote call fails + */ + public function createAlertPolicy($name, $alertPolicy, array $optionalArgs = []) + { + $request = new CreateAlertPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setAlertPolicy($alertPolicy); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateAlertPolicy', AlertPolicy::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * Sample code: + * ``` + * $alertPolicyServiceClient = new AlertPolicyServiceClient(); + * try { + * $formattedName = $alertPolicyServiceClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + * $alertPolicyServiceClient->deleteAlertPolicy($formattedName); + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The alerting policy to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteAlertPolicy($name, array $optionalArgs = []) + { + $request = new DeleteAlertPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteAlertPolicy', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single alerting policy. + * + * Sample code: + * ``` + * $alertPolicyServiceClient = new AlertPolicyServiceClient(); + * try { + * $formattedName = $alertPolicyServiceClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + * $response = $alertPolicyServiceClient->getAlertPolicy($formattedName); + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The alerting policy to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\AlertPolicy + * + * @throws ApiException if the remote call fails + */ + public function getAlertPolicy($name, array $optionalArgs = []) + { + $request = new GetAlertPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAlertPolicy', AlertPolicy::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the existing alerting policies for the workspace. + * + * Sample code: + * ``` + * $alertPolicyServiceClient = new AlertPolicyServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $alertPolicyServiceClient->listAlertPolicies($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alertPolicyServiceClient->listAlertPolicies($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + * operation, instead. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type string $orderBy + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAlertPolicies($name, array $optionalArgs = []) + { + $request = new ListAlertPoliciesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAlertPolicies', $optionalArgs, ListAlertPoliciesResponse::class, $request); + } + + /** + * Updates an alerting policy. You can either replace the entire policy with + * a new one or replace only certain fields in the current alerting policy by + * specifying the fields to be updated via `updateMask`. Returns the + * updated alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * Sample code: + * ``` + * $alertPolicyServiceClient = new AlertPolicyServiceClient(); + * try { + * $alertPolicy = new AlertPolicy(); + * $response = $alertPolicyServiceClient->updateAlertPolicy($alertPolicy); + * } finally { + * $alertPolicyServiceClient->close(); + * } + * ``` + * + * @param AlertPolicy $alertPolicy Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\AlertPolicy + * + * @throws ApiException if the remote call fails + */ + public function updateAlertPolicy($alertPolicy, array $optionalArgs = []) + { + $request = new UpdateAlertPolicyRequest(); + $requestParamHeaders = []; + $request->setAlertPolicy($alertPolicy); + $requestParamHeaders['alert_policy.name'] = $alertPolicy->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateAlertPolicy', AlertPolicy::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/GroupServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/GroupServiceGapicClient.php new file mode 100644 index 000000000000..04306c6bc04e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/GroupServiceGapicClient.php @@ -0,0 +1,752 @@ +createGroup($name, $group); + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\GroupServiceClient}. + */ +class GroupServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.GroupService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $folderGroupNameTemplate; + + private static $groupNameTemplate; + + private static $organizationGroupNameTemplate; + + private static $projectGroupNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/group_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/group_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/group_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/group_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderGroupNameTemplate() + { + if (self::$folderGroupNameTemplate == null) { + self::$folderGroupNameTemplate = new PathTemplate('folders/{folder}/groups/{group}'); + } + + return self::$folderGroupNameTemplate; + } + + private static function getGroupNameTemplate() + { + if (self::$groupNameTemplate == null) { + self::$groupNameTemplate = new PathTemplate('projects/{project}/groups/{group}'); + } + + return self::$groupNameTemplate; + } + + private static function getOrganizationGroupNameTemplate() + { + if (self::$organizationGroupNameTemplate == null) { + self::$organizationGroupNameTemplate = new PathTemplate('organizations/{organization}/groups/{group}'); + } + + return self::$organizationGroupNameTemplate; + } + + private static function getProjectGroupNameTemplate() + { + if (self::$projectGroupNameTemplate == null) { + self::$projectGroupNameTemplate = new PathTemplate('projects/{project}/groups/{group}'); + } + + return self::$projectGroupNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folderGroup' => self::getFolderGroupNameTemplate(), + 'group' => self::getGroupNameTemplate(), + 'organizationGroup' => self::getOrganizationGroupNameTemplate(), + 'projectGroup' => self::getProjectGroupNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder_group + * resource. + * + * @param string $folder + * @param string $group + * + * @return string The formatted folder_group resource. + */ + public static function folderGroupName($folder, $group) + { + return self::getFolderGroupNameTemplate()->render([ + 'folder' => $folder, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a group + * resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted group resource. + */ + public static function groupName($project, $group) + { + return self::getGroupNameTemplate()->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_group resource. + * + * @param string $organization + * @param string $group + * + * @return string The formatted organization_group resource. + */ + public static function organizationGroupName($organization, $group) + { + return self::getOrganizationGroupNameTemplate()->render([ + 'organization' => $organization, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_group resource. + * + * @param string $project + * @param string $group + * + * @return string The formatted project_group resource. + */ + public static function projectGroupName($project, $group) + { + return self::getProjectGroupNameTemplate()->render([ + 'project' => $project, + 'group' => $group, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderGroup: folders/{folder}/groups/{group} + * - group: projects/{project}/groups/{group} + * - organizationGroup: organizations/{organization}/groups/{group} + * - projectGroup: projects/{project}/groups/{group} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new group. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $name = 'name'; + * $group = new Group(); + * $response = $groupServiceClient->createGroup($name, $group); + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param Group $group Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If true, validate this request but do not create the group. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Group + * + * @throws ApiException if the remote call fails + */ + public function createGroup($name, $group, array $optionalArgs = []) + { + $request = new CreateGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setGroup($group); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateGroup', Group::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an existing group. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); + * $groupServiceClient->deleteGroup($formattedName); + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The group to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param array $optionalArgs { + * Optional. + * + * @type bool $recursive + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteGroup($name, array $optionalArgs = []) + { + $request = new DeleteGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['recursive'])) { + $request->setRecursive($optionalArgs['recursive']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteGroup', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single group. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); + * $response = $groupServiceClient->getGroup($formattedName); + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The group to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Group + * + * @throws ApiException if the remote call fails + */ + public function getGroup($name, array $optionalArgs = []) + { + $request = new GetGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGroup', Group::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the monitored resources that are members of a group. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); + * // Iterate over pages of elements + * $pagedResponse = $groupServiceClient->listGroupMembers($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $groupServiceClient->listGroupMembers($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @type TimeInterval $interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGroupMembers($name, array $optionalArgs = []) + { + $request = new ListGroupMembersRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['interval'])) { + $request->setInterval($optionalArgs['interval']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGroupMembers', $optionalArgs, ListGroupMembersResponse::class, $request); + } + + /** + * Lists the existing groups. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $groupServiceClient->listGroups($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $groupServiceClient->listGroups($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @type string $ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @type string $descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGroups($name, array $optionalArgs = []) + { + $request = new ListGroupsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['childrenOfGroup'])) { + $request->setChildrenOfGroup($optionalArgs['childrenOfGroup']); + } + + if (isset($optionalArgs['ancestorsOfGroup'])) { + $request->setAncestorsOfGroup($optionalArgs['ancestorsOfGroup']); + } + + if (isset($optionalArgs['descendantsOfGroup'])) { + $request->setDescendantsOfGroup($optionalArgs['descendantsOfGroup']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGroups', $optionalArgs, ListGroupsResponse::class, $request); + } + + /** + * Updates an existing group. + * You can change any group attributes except `name`. + * + * Sample code: + * ``` + * $groupServiceClient = new GroupServiceClient(); + * try { + * $group = new Group(); + * $response = $groupServiceClient->updateGroup($group); + * } finally { + * $groupServiceClient->close(); + * } + * ``` + * + * @param Group $group Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * If true, validate this request but do not update the existing group. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Group + * + * @throws ApiException if the remote call fails + */ + public function updateGroup($group, array $optionalArgs = []) + { + $request = new UpdateGroupRequest(); + $requestParamHeaders = []; + $request->setGroup($group); + $requestParamHeaders['group.name'] = $group->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateGroup', Group::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/MetricServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/MetricServiceGapicClient.php new file mode 100644 index 000000000000..de1708a3ea67 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/MetricServiceGapicClient.php @@ -0,0 +1,1178 @@ +createMetricDescriptor($name, $metricDescriptor); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\MetricServiceClient}. + */ +class MetricServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.MetricService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + 'https://www.googleapis.com/auth/monitoring.write', + ]; + + private static $folderNameTemplate; + + private static $folderMetricDescriptorNameTemplate; + + private static $folderMonitoredResourceDescriptorNameTemplate; + + private static $metricDescriptorNameTemplate; + + private static $monitoredResourceDescriptorNameTemplate; + + private static $organizationNameTemplate; + + private static $organizationMetricDescriptorNameTemplate; + + private static $organizationMonitoredResourceDescriptorNameTemplate; + + private static $projectNameTemplate; + + private static $projectMetricDescriptorNameTemplate; + + private static $projectMonitoredResourceDescriptorNameTemplate; + + private static $workspaceNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/metric_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/metric_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/metric_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/metric_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderNameTemplate() + { + if (self::$folderNameTemplate == null) { + self::$folderNameTemplate = new PathTemplate('folders/{folder}'); + } + + return self::$folderNameTemplate; + } + + private static function getFolderMetricDescriptorNameTemplate() + { + if (self::$folderMetricDescriptorNameTemplate == null) { + self::$folderMetricDescriptorNameTemplate = new PathTemplate('folders/{folder}/metricDescriptors/{metric_descriptor=**}'); + } + + return self::$folderMetricDescriptorNameTemplate; + } + + private static function getFolderMonitoredResourceDescriptorNameTemplate() + { + if (self::$folderMonitoredResourceDescriptorNameTemplate == null) { + self::$folderMonitoredResourceDescriptorNameTemplate = new PathTemplate('folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}'); + } + + return self::$folderMonitoredResourceDescriptorNameTemplate; + } + + private static function getMetricDescriptorNameTemplate() + { + if (self::$metricDescriptorNameTemplate == null) { + self::$metricDescriptorNameTemplate = new PathTemplate('projects/{project}/metricDescriptors/{metric_descriptor=**}'); + } + + return self::$metricDescriptorNameTemplate; + } + + private static function getMonitoredResourceDescriptorNameTemplate() + { + if (self::$monitoredResourceDescriptorNameTemplate == null) { + self::$monitoredResourceDescriptorNameTemplate = new PathTemplate('projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}'); + } + + return self::$monitoredResourceDescriptorNameTemplate; + } + + private static function getOrganizationNameTemplate() + { + if (self::$organizationNameTemplate == null) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + + private static function getOrganizationMetricDescriptorNameTemplate() + { + if (self::$organizationMetricDescriptorNameTemplate == null) { + self::$organizationMetricDescriptorNameTemplate = new PathTemplate('organizations/{organization}/metricDescriptors/{metric_descriptor=**}'); + } + + return self::$organizationMetricDescriptorNameTemplate; + } + + private static function getOrganizationMonitoredResourceDescriptorNameTemplate() + { + if (self::$organizationMonitoredResourceDescriptorNameTemplate == null) { + self::$organizationMonitoredResourceDescriptorNameTemplate = new PathTemplate('organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}'); + } + + return self::$organizationMonitoredResourceDescriptorNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectMetricDescriptorNameTemplate() + { + if (self::$projectMetricDescriptorNameTemplate == null) { + self::$projectMetricDescriptorNameTemplate = new PathTemplate('projects/{project}/metricDescriptors/{metric_descriptor=**}'); + } + + return self::$projectMetricDescriptorNameTemplate; + } + + private static function getProjectMonitoredResourceDescriptorNameTemplate() + { + if (self::$projectMonitoredResourceDescriptorNameTemplate == null) { + self::$projectMonitoredResourceDescriptorNameTemplate = new PathTemplate('projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}'); + } + + return self::$projectMonitoredResourceDescriptorNameTemplate; + } + + private static function getWorkspaceNameTemplate() + { + if (self::$workspaceNameTemplate == null) { + self::$workspaceNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$workspaceNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folder' => self::getFolderNameTemplate(), + 'folderMetricDescriptor' => self::getFolderMetricDescriptorNameTemplate(), + 'folderMonitoredResourceDescriptor' => self::getFolderMonitoredResourceDescriptorNameTemplate(), + 'metricDescriptor' => self::getMetricDescriptorNameTemplate(), + 'monitoredResourceDescriptor' => self::getMonitoredResourceDescriptorNameTemplate(), + 'organization' => self::getOrganizationNameTemplate(), + 'organizationMetricDescriptor' => self::getOrganizationMetricDescriptorNameTemplate(), + 'organizationMonitoredResourceDescriptor' => self::getOrganizationMonitoredResourceDescriptorNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectMetricDescriptor' => self::getProjectMetricDescriptorNameTemplate(), + 'projectMonitoredResourceDescriptor' => self::getProjectMonitoredResourceDescriptorNameTemplate(), + 'workspace' => self::getWorkspaceNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName($folder) + { + return self::getFolderNameTemplate()->render([ + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_metric_descriptor resource. + * + * @param string $folder + * @param string $metricDescriptor + * + * @return string The formatted folder_metric_descriptor resource. + */ + public static function folderMetricDescriptorName($folder, $metricDescriptor) + { + return self::getFolderMetricDescriptorNameTemplate()->render([ + 'folder' => $folder, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_monitored_resource_descriptor resource. + * + * @param string $folder + * @param string $monitoredResourceDescriptor + * + * @return string The formatted folder_monitored_resource_descriptor resource. + */ + public static function folderMonitoredResourceDescriptorName($folder, $monitoredResourceDescriptor) + { + return self::getFolderMonitoredResourceDescriptorNameTemplate()->render([ + 'folder' => $folder, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * metric_descriptor resource. + * + * @param string $project + * @param string $metricDescriptor + * + * @return string The formatted metric_descriptor resource. + */ + public static function metricDescriptorName($project, $metricDescriptor) + { + return self::getMetricDescriptorNameTemplate()->render([ + 'project' => $project, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * monitored_resource_descriptor resource. + * + * @param string $project + * @param string $monitoredResourceDescriptor + * + * @return string The formatted monitored_resource_descriptor resource. + */ + public static function monitoredResourceDescriptorName($project, $monitoredResourceDescriptor) + { + return self::getMonitoredResourceDescriptorNameTemplate()->render([ + 'project' => $project, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_metric_descriptor resource. + * + * @param string $organization + * @param string $metricDescriptor + * + * @return string The formatted organization_metric_descriptor resource. + */ + public static function organizationMetricDescriptorName($organization, $metricDescriptor) + { + return self::getOrganizationMetricDescriptorNameTemplate()->render([ + 'organization' => $organization, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_monitored_resource_descriptor resource. + * + * @param string $organization + * @param string $monitoredResourceDescriptor + * + * @return string The formatted organization_monitored_resource_descriptor resource. + */ + public static function organizationMonitoredResourceDescriptorName($organization, $monitoredResourceDescriptor) + { + return self::getOrganizationMonitoredResourceDescriptorNameTemplate()->render([ + 'organization' => $organization, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_metric_descriptor resource. + * + * @param string $project + * @param string $metricDescriptor + * + * @return string The formatted project_metric_descriptor resource. + */ + public static function projectMetricDescriptorName($project, $metricDescriptor) + { + return self::getProjectMetricDescriptorNameTemplate()->render([ + 'project' => $project, + 'metric_descriptor' => $metricDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_monitored_resource_descriptor resource. + * + * @param string $project + * @param string $monitoredResourceDescriptor + * + * @return string The formatted project_monitored_resource_descriptor resource. + */ + public static function projectMonitoredResourceDescriptorName($project, $monitoredResourceDescriptor) + { + return self::getProjectMonitoredResourceDescriptorNameTemplate()->render([ + 'project' => $project, + 'monitored_resource_descriptor' => $monitoredResourceDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * + * @return string The formatted workspace resource. + */ + public static function workspaceName($project) + { + return self::getWorkspaceNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folder: folders/{folder} + * - folderMetricDescriptor: folders/{folder}/metricDescriptors/{metric_descriptor=**} + * - folderMonitoredResourceDescriptor: folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - metricDescriptor: projects/{project}/metricDescriptors/{metric_descriptor=**} + * - monitoredResourceDescriptor: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - organization: organizations/{organization} + * - organizationMetricDescriptor: organizations/{organization}/metricDescriptors/{metric_descriptor=**} + * - organizationMonitoredResourceDescriptor: organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - project: projects/{project} + * - projectMetricDescriptor: projects/{project}/metricDescriptors/{metric_descriptor=**} + * - projectMonitoredResourceDescriptor: projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor} + * - workspace: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new metric descriptor. + * The creation is executed asynchronously. + * User-created metric descriptors define + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics). + * The metric descriptor is updated if it already exists, + * except that metric labels are never removed. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $name = 'name'; + * $metricDescriptor = new MetricDescriptor(); + * $response = $metricServiceClient->createMetricDescriptor($name, $metricDescriptor); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * @param MetricDescriptor $metricDescriptor Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Api\MetricDescriptor + * + * @throws ApiException if the remote call fails + */ + public function createMetricDescriptor($name, $metricDescriptor, array $optionalArgs = []) + { + $request = new CreateMetricDescriptorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setMetricDescriptor($metricDescriptor); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateMetricDescriptor', MetricDescriptor::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates or adds data to one or more service time series. A service time + * series is a time series for a metric from a Google Cloud service. The + * response is empty if all time series in the request were written. If any + * time series could not be written, a corresponding failure message is + * included in the error response. This endpoint rejects writes to + * user-defined metrics. + * This method is only for use by Google Cloud services. Use + * [projects.timeSeries.create][google.monitoring.v3.MetricService.CreateTimeSeries] + * instead. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); + * $timeSeries = []; + * $metricServiceClient->createServiceTimeSeries($formattedName, $timeSeries); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param TimeSeries[] $timeSeries Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function createServiceTimeSeries($name, $timeSeries, array $optionalArgs = []) + { + $request = new CreateTimeSeriesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setTimeSeries($timeSeries); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateServiceTimeSeries', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates or adds data to one or more time series. + * The response is empty if all time series in the request were written. + * If any time series could not be written, a corresponding failure message is + * included in the error response. + * This method does not support + * [resource locations constraint of an organization + * policy](https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy). + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); + * $timeSeries = []; + * $metricServiceClient->createTimeSeries($formattedName, $timeSeries); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param TimeSeries[] $timeSeries Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function createTimeSeries($name, $timeSeries, array $optionalArgs = []) + { + $request = new CreateTimeSeriesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setTimeSeries($timeSeries); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateTimeSeries', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a metric descriptor. Only user-created + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be + * deleted. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + * $metricServiceClient->deleteMetricDescriptor($formattedName); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteMetricDescriptor($name, array $optionalArgs = []) + { + $request = new DeleteMetricDescriptorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteMetricDescriptor', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single metric descriptor. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + * $response = $metricServiceClient->getMetricDescriptor($formattedName); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Api\MetricDescriptor + * + * @throws ApiException if the remote call fails + */ + public function getMetricDescriptor($name, array $optionalArgs = []) + { + $request = new GetMetricDescriptorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMetricDescriptor', MetricDescriptor::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single monitored resource descriptor. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); + * $response = $metricServiceClient->getMonitoredResourceDescriptor($formattedName); + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The monitored resource descriptor to get. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Api\MonitoredResourceDescriptor + * + * @throws ApiException if the remote call fails + */ + public function getMonitoredResourceDescriptor($name, array $optionalArgs = []) + { + $request = new GetMonitoredResourceDescriptorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMonitoredResourceDescriptor', MonitoredResourceDescriptor::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists metric descriptors that match a filter. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $metricServiceClient->listMetricDescriptors($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $metricServiceClient->listMetricDescriptors($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listMetricDescriptors($name, array $optionalArgs = []) + { + $request = new ListMetricDescriptorsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMetricDescriptors', $optionalArgs, ListMetricDescriptorsResponse::class, $request); + } + + /** + * Lists monitored resource descriptors that match a filter. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listMonitoredResourceDescriptors($name, array $optionalArgs = []) + { + $request = new ListMonitoredResourceDescriptorsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMonitoredResourceDescriptors', $optionalArgs, ListMonitoredResourceDescriptorsResponse::class, $request); + } + + /** + * Lists time series that match a filter. + * + * Sample code: + * ``` + * $metricServiceClient = new MetricServiceClient(); + * try { + * $formattedName = $metricServiceClient->workspaceName('[PROJECT]'); + * $filter = 'filter'; + * $interval = new TimeInterval(); + * $view = TimeSeriesView::FULL; + * // Iterate over pages of elements + * $pagedResponse = $metricServiceClient->listTimeSeries($formattedName, $filter, $interval, $view); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $metricServiceClient->listTimeSeries($formattedName, $filter, $interval, $view); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $metricServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param string $filter Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param TimeInterval $interval Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @param int $view Required. Specifies which information is returned about the time series. + * For allowed values, use constants defined on {@see \Google\Cloud\Monitoring\V3\ListTimeSeriesRequest\TimeSeriesView} + * @param array $optionalArgs { + * Optional. + * + * @type Aggregation $aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @type Aggregation $secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @type string $orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTimeSeries($name, $filter, $interval, $view, array $optionalArgs = []) + { + $request = new ListTimeSeriesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setFilter($filter); + $request->setInterval($interval); + $request->setView($view); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['aggregation'])) { + $request->setAggregation($optionalArgs['aggregation']); + } + + if (isset($optionalArgs['secondaryAggregation'])) { + $request->setSecondaryAggregation($optionalArgs['secondaryAggregation']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTimeSeries', $optionalArgs, ListTimeSeriesResponse::class, $request); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/NotificationChannelServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/NotificationChannelServiceGapicClient.php new file mode 100644 index 000000000000..75cf9393bd47 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/NotificationChannelServiceGapicClient.php @@ -0,0 +1,1075 @@ +createNotificationChannel($name, $notificationChannel); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\NotificationChannelServiceClient}. + */ +class NotificationChannelServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.NotificationChannelService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $folderChannelDescriptorNameTemplate; + + private static $folderNotificationChannelNameTemplate; + + private static $notificationChannelNameTemplate; + + private static $notificationChannelDescriptorNameTemplate; + + private static $organizationChannelDescriptorNameTemplate; + + private static $organizationNotificationChannelNameTemplate; + + private static $projectChannelDescriptorNameTemplate; + + private static $projectNotificationChannelNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/notification_channel_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/notification_channel_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/notification_channel_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/notification_channel_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderChannelDescriptorNameTemplate() + { + if (self::$folderChannelDescriptorNameTemplate == null) { + self::$folderChannelDescriptorNameTemplate = new PathTemplate('folders/{folder}/notificationChannelDescriptors/{channel_descriptor}'); + } + + return self::$folderChannelDescriptorNameTemplate; + } + + private static function getFolderNotificationChannelNameTemplate() + { + if (self::$folderNotificationChannelNameTemplate == null) { + self::$folderNotificationChannelNameTemplate = new PathTemplate('folders/{folder}/notificationChannels/{notification_channel}'); + } + + return self::$folderNotificationChannelNameTemplate; + } + + private static function getNotificationChannelNameTemplate() + { + if (self::$notificationChannelNameTemplate == null) { + self::$notificationChannelNameTemplate = new PathTemplate('projects/{project}/notificationChannels/{notification_channel}'); + } + + return self::$notificationChannelNameTemplate; + } + + private static function getNotificationChannelDescriptorNameTemplate() + { + if (self::$notificationChannelDescriptorNameTemplate == null) { + self::$notificationChannelDescriptorNameTemplate = new PathTemplate('projects/{project}/notificationChannelDescriptors/{channel_descriptor}'); + } + + return self::$notificationChannelDescriptorNameTemplate; + } + + private static function getOrganizationChannelDescriptorNameTemplate() + { + if (self::$organizationChannelDescriptorNameTemplate == null) { + self::$organizationChannelDescriptorNameTemplate = new PathTemplate('organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}'); + } + + return self::$organizationChannelDescriptorNameTemplate; + } + + private static function getOrganizationNotificationChannelNameTemplate() + { + if (self::$organizationNotificationChannelNameTemplate == null) { + self::$organizationNotificationChannelNameTemplate = new PathTemplate('organizations/{organization}/notificationChannels/{notification_channel}'); + } + + return self::$organizationNotificationChannelNameTemplate; + } + + private static function getProjectChannelDescriptorNameTemplate() + { + if (self::$projectChannelDescriptorNameTemplate == null) { + self::$projectChannelDescriptorNameTemplate = new PathTemplate('projects/{project}/notificationChannelDescriptors/{channel_descriptor}'); + } + + return self::$projectChannelDescriptorNameTemplate; + } + + private static function getProjectNotificationChannelNameTemplate() + { + if (self::$projectNotificationChannelNameTemplate == null) { + self::$projectNotificationChannelNameTemplate = new PathTemplate('projects/{project}/notificationChannels/{notification_channel}'); + } + + return self::$projectNotificationChannelNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folderChannelDescriptor' => self::getFolderChannelDescriptorNameTemplate(), + 'folderNotificationChannel' => self::getFolderNotificationChannelNameTemplate(), + 'notificationChannel' => self::getNotificationChannelNameTemplate(), + 'notificationChannelDescriptor' => self::getNotificationChannelDescriptorNameTemplate(), + 'organizationChannelDescriptor' => self::getOrganizationChannelDescriptorNameTemplate(), + 'organizationNotificationChannel' => self::getOrganizationNotificationChannelNameTemplate(), + 'projectChannelDescriptor' => self::getProjectChannelDescriptorNameTemplate(), + 'projectNotificationChannel' => self::getProjectNotificationChannelNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_channel_descriptor resource. + * + * @param string $folder + * @param string $channelDescriptor + * + * @return string The formatted folder_channel_descriptor resource. + */ + public static function folderChannelDescriptorName($folder, $channelDescriptor) + { + return self::getFolderChannelDescriptorNameTemplate()->render([ + 'folder' => $folder, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_notification_channel resource. + * + * @param string $folder + * @param string $notificationChannel + * + * @return string The formatted folder_notification_channel resource. + */ + public static function folderNotificationChannelName($folder, $notificationChannel) + { + return self::getFolderNotificationChannelNameTemplate()->render([ + 'folder' => $folder, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * notification_channel resource. + * + * @param string $project + * @param string $notificationChannel + * + * @return string The formatted notification_channel resource. + */ + public static function notificationChannelName($project, $notificationChannel) + { + return self::getNotificationChannelNameTemplate()->render([ + 'project' => $project, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * notification_channel_descriptor resource. + * + * @param string $project + * @param string $channelDescriptor + * + * @return string The formatted notification_channel_descriptor resource. + */ + public static function notificationChannelDescriptorName($project, $channelDescriptor) + { + return self::getNotificationChannelDescriptorNameTemplate()->render([ + 'project' => $project, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_channel_descriptor resource. + * + * @param string $organization + * @param string $channelDescriptor + * + * @return string The formatted organization_channel_descriptor resource. + */ + public static function organizationChannelDescriptorName($organization, $channelDescriptor) + { + return self::getOrganizationChannelDescriptorNameTemplate()->render([ + 'organization' => $organization, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_notification_channel resource. + * + * @param string $organization + * @param string $notificationChannel + * + * @return string The formatted organization_notification_channel resource. + */ + public static function organizationNotificationChannelName($organization, $notificationChannel) + { + return self::getOrganizationNotificationChannelNameTemplate()->render([ + 'organization' => $organization, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_channel_descriptor resource. + * + * @param string $project + * @param string $channelDescriptor + * + * @return string The formatted project_channel_descriptor resource. + */ + public static function projectChannelDescriptorName($project, $channelDescriptor) + { + return self::getProjectChannelDescriptorNameTemplate()->render([ + 'project' => $project, + 'channel_descriptor' => $channelDescriptor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_notification_channel resource. + * + * @param string $project + * @param string $notificationChannel + * + * @return string The formatted project_notification_channel resource. + */ + public static function projectNotificationChannelName($project, $notificationChannel) + { + return self::getProjectNotificationChannelNameTemplate()->render([ + 'project' => $project, + 'notification_channel' => $notificationChannel, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderChannelDescriptor: folders/{folder}/notificationChannelDescriptors/{channel_descriptor} + * - folderNotificationChannel: folders/{folder}/notificationChannels/{notification_channel} + * - notificationChannel: projects/{project}/notificationChannels/{notification_channel} + * - notificationChannelDescriptor: projects/{project}/notificationChannelDescriptors/{channel_descriptor} + * - organizationChannelDescriptor: organizations/{organization}/notificationChannelDescriptors/{channel_descriptor} + * - organizationNotificationChannel: organizations/{organization}/notificationChannels/{notification_channel} + * - projectChannelDescriptor: projects/{project}/notificationChannelDescriptors/{channel_descriptor} + * - projectNotificationChannel: projects/{project}/notificationChannels/{notification_channel} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new notification channel, representing a single notification + * endpoint such as an email address, SMS number, or PagerDuty service. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $name = 'name'; + * $notificationChannel = new NotificationChannel(); + * $response = $notificationChannelServiceClient->createNotificationChannel($name, $notificationChannel); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * @param NotificationChannel $notificationChannel Required. The definition of the `NotificationChannel` to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\NotificationChannel + * + * @throws ApiException if the remote call fails + */ + public function createNotificationChannel($name, $notificationChannel, array $optionalArgs = []) + { + $request = new CreateNotificationChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setNotificationChannel($notificationChannel); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateNotificationChannel', NotificationChannel::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a notification channel. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + * $notificationChannelServiceClient->deleteNotificationChannel($formattedName); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteNotificationChannel($name, array $optionalArgs = []) + { + $request = new DeleteNotificationChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteNotificationChannel', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single notification channel. The channel includes the relevant + * configuration details with which the channel was created. However, the + * response may truncate or omit passwords, API keys, or other private key + * matter and thus the response may not be 100% identical to the information + * that was supplied in the call to the create method. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + * $response = $notificationChannelServiceClient->getNotificationChannel($formattedName); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\NotificationChannel + * + * @throws ApiException if the remote call fails + */ + public function getNotificationChannel($name, array $optionalArgs = []) + { + $request = new GetNotificationChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNotificationChannel', NotificationChannel::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single channel descriptor. The descriptor indicates which fields + * are expected / permitted for a notification channel of the given type. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelDescriptorName('[PROJECT]', '[CHANNEL_DESCRIPTOR]'); + * $response = $notificationChannelServiceClient->getNotificationChannelDescriptor($formattedName); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The channel type for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\NotificationChannelDescriptor + * + * @throws ApiException if the remote call fails + */ + public function getNotificationChannelDescriptor($name, array $optionalArgs = []) + { + $request = new GetNotificationChannelDescriptorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNotificationChannelDescriptor', NotificationChannelDescriptor::class, $optionalArgs, $request)->wait(); + } + + /** + * Requests a verification code for an already verified channel that can then + * be used in a call to VerifyNotificationChannel() on a different channel + * with an equivalent identity in the same or in a different project. This + * makes it possible to copy a channel between projects without requiring + * manual reverification of the channel. If the channel is not in the + * verified state, this method will fail (in other words, this may only be + * used if the SendNotificationChannelVerificationCode and + * VerifyNotificationChannel paths have already been used to put the given + * channel into the verified state). + * + * There is no guarantee that the verification codes returned by this method + * will be of a similar structure or form as the ones that are delivered + * to the channel via SendNotificationChannelVerificationCode; while + * VerifyNotificationChannel() will recognize both the codes delivered via + * SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that + * the verification codes delivered via + * SendNotificationChannelVerificationCode() will be shorter and also + * have a shorter expiration (e.g. codes such as "G-123456") whereas + * GetVerificationCode() will typically return a much longer, websafe base + * 64 encoded string that has a longer expiration time. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + * $response = $notificationChannelServiceClient->getNotificationChannelVerificationCode($formattedName); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * @param array $optionalArgs { + * Optional. + * + * @type Timestamp $expireTime + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\GetNotificationChannelVerificationCodeResponse + * + * @throws ApiException if the remote call fails + */ + public function getNotificationChannelVerificationCode($name, array $optionalArgs = []) + { + $request = new GetNotificationChannelVerificationCodeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['expireTime'])) { + $request->setExpireTime($optionalArgs['expireTime']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNotificationChannelVerificationCode', GetNotificationChannelVerificationCodeResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the descriptors for supported channel types. The use of descriptors + * makes it possible for new channel types to be dynamically added. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $notificationChannelServiceClient->listNotificationChannelDescriptors($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $notificationChannelServiceClient->listNotificationChannelDescriptors($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNotificationChannelDescriptors($name, array $optionalArgs = []) + { + $request = new ListNotificationChannelDescriptorsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNotificationChannelDescriptors', $optionalArgs, ListNotificationChannelDescriptorsResponse::class, $request); + } + + /** + * Lists the notification channels that have been created for the project. + * To list the types of notification channels that are supported, use + * the `ListNotificationChannelDescriptors` method. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $name = 'name'; + * // Iterate over pages of elements + * $pagedResponse = $notificationChannelServiceClient->listNotificationChannels($name); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $notificationChannelServiceClient->listNotificationChannels($name); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type string $orderBy + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNotificationChannels($name, array $optionalArgs = []) + { + $request = new ListNotificationChannelsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNotificationChannels', $optionalArgs, ListNotificationChannelsResponse::class, $request); + } + + /** + * Causes a verification code to be delivered to the channel. The code + * can then be supplied in `VerifyNotificationChannel` to verify the channel. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + * $notificationChannelServiceClient->sendNotificationChannelVerificationCode($formattedName); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The notification channel to which to send a verification code. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function sendNotificationChannelVerificationCode($name, array $optionalArgs = []) + { + $request = new SendNotificationChannelVerificationCodeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SendNotificationChannelVerificationCode', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a notification channel. Fields not specified in the field mask + * remain unchanged. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $notificationChannel = new NotificationChannel(); + * $response = $notificationChannelServiceClient->updateNotificationChannel($notificationChannel); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param NotificationChannel $notificationChannel Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. The fields to update. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\NotificationChannel + * + * @throws ApiException if the remote call fails + */ + public function updateNotificationChannel($notificationChannel, array $optionalArgs = []) + { + $request = new UpdateNotificationChannelRequest(); + $requestParamHeaders = []; + $request->setNotificationChannel($notificationChannel); + $requestParamHeaders['notification_channel.name'] = $notificationChannel->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateNotificationChannel', NotificationChannel::class, $optionalArgs, $request)->wait(); + } + + /** + * Verifies a `NotificationChannel` by proving receipt of the code + * delivered to the channel as a result of calling + * `SendNotificationChannelVerificationCode`. + * + * Sample code: + * ``` + * $notificationChannelServiceClient = new NotificationChannelServiceClient(); + * try { + * $formattedName = $notificationChannelServiceClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + * $code = 'code'; + * $response = $notificationChannelServiceClient->verifyNotificationChannel($formattedName, $code); + * } finally { + * $notificationChannelServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The notification channel to verify. + * @param string $code Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\NotificationChannel + * + * @throws ApiException if the remote call fails + */ + public function verifyNotificationChannel($name, $code, array $optionalArgs = []) + { + $request = new VerifyNotificationChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setCode($code); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('VerifyNotificationChannel', NotificationChannel::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/QueryServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/QueryServiceGapicClient.php new file mode 100644 index 000000000000..13009bf13097 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/QueryServiceGapicClient.php @@ -0,0 +1,261 @@ +queryTimeSeries($name, $query); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $queryServiceClient->queryTimeSeries($name, $query); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $queryServiceClient->close(); + * } + * ``` + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\QueryServiceClient}. + */ +class QueryServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.QueryService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/query_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/query_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/query_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/query_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Queries time series by using Monitoring Query Language (MQL). We recommend + * using PromQL instead of MQL. For more information about the status of MQL, + * see the [MQL deprecation + * notice](https://cloud.google.com/stackdriver/docs/deprecations/mql). + * + * Sample code: + * ``` + * $queryServiceClient = new QueryServiceClient(); + * try { + * $name = 'name'; + * $query = 'query'; + * // Iterate over pages of elements + * $pagedResponse = $queryServiceClient->queryTimeSeries($name, $query); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $queryServiceClient->queryTimeSeries($name, $query); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $queryServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param string $query Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @deprecated This method will be removed in the next major version update. + */ + public function queryTimeSeries($name, $query, array $optionalArgs = []) + { + $request = new QueryTimeSeriesRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setQuery($query); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('QueryTimeSeries', $optionalArgs, QueryTimeSeriesResponse::class, $request); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/ServiceMonitoringServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/ServiceMonitoringServiceGapicClient.php new file mode 100644 index 000000000000..c7cc9a8589b9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/ServiceMonitoringServiceGapicClient.php @@ -0,0 +1,1044 @@ +createService($parent, $service); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\ServiceMonitoringServiceClient}. + */ +class ServiceMonitoringServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.ServiceMonitoringService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $folderServiceNameTemplate; + + private static $folderServiceServiceLevelObjectiveNameTemplate; + + private static $organizationServiceNameTemplate; + + private static $organizationServiceServiceLevelObjectiveNameTemplate; + + private static $projectServiceNameTemplate; + + private static $projectServiceServiceLevelObjectiveNameTemplate; + + private static $serviceNameTemplate; + + private static $serviceLevelObjectiveNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/service_monitoring_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/service_monitoring_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/service_monitoring_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/service_monitoring_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderServiceNameTemplate() + { + if (self::$folderServiceNameTemplate == null) { + self::$folderServiceNameTemplate = new PathTemplate('folders/{folder}/services/{service}'); + } + + return self::$folderServiceNameTemplate; + } + + private static function getFolderServiceServiceLevelObjectiveNameTemplate() + { + if (self::$folderServiceServiceLevelObjectiveNameTemplate == null) { + self::$folderServiceServiceLevelObjectiveNameTemplate = new PathTemplate('folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}'); + } + + return self::$folderServiceServiceLevelObjectiveNameTemplate; + } + + private static function getOrganizationServiceNameTemplate() + { + if (self::$organizationServiceNameTemplate == null) { + self::$organizationServiceNameTemplate = new PathTemplate('organizations/{organization}/services/{service}'); + } + + return self::$organizationServiceNameTemplate; + } + + private static function getOrganizationServiceServiceLevelObjectiveNameTemplate() + { + if (self::$organizationServiceServiceLevelObjectiveNameTemplate == null) { + self::$organizationServiceServiceLevelObjectiveNameTemplate = new PathTemplate('organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}'); + } + + return self::$organizationServiceServiceLevelObjectiveNameTemplate; + } + + private static function getProjectServiceNameTemplate() + { + if (self::$projectServiceNameTemplate == null) { + self::$projectServiceNameTemplate = new PathTemplate('projects/{project}/services/{service}'); + } + + return self::$projectServiceNameTemplate; + } + + private static function getProjectServiceServiceLevelObjectiveNameTemplate() + { + if (self::$projectServiceServiceLevelObjectiveNameTemplate == null) { + self::$projectServiceServiceLevelObjectiveNameTemplate = new PathTemplate('projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}'); + } + + return self::$projectServiceServiceLevelObjectiveNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getServiceLevelObjectiveNameTemplate() + { + if (self::$serviceLevelObjectiveNameTemplate == null) { + self::$serviceLevelObjectiveNameTemplate = new PathTemplate('projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}'); + } + + return self::$serviceLevelObjectiveNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folderService' => self::getFolderServiceNameTemplate(), + 'folderServiceServiceLevelObjective' => self::getFolderServiceServiceLevelObjectiveNameTemplate(), + 'organizationService' => self::getOrganizationServiceNameTemplate(), + 'organizationServiceServiceLevelObjective' => self::getOrganizationServiceServiceLevelObjectiveNameTemplate(), + 'projectService' => self::getProjectServiceNameTemplate(), + 'projectServiceServiceLevelObjective' => self::getProjectServiceServiceLevelObjectiveNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'serviceLevelObjective' => self::getServiceLevelObjectiveNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_service resource. + * + * @param string $folder + * @param string $service + * + * @return string The formatted folder_service resource. + */ + public static function folderServiceName($folder, $service) + { + return self::getFolderServiceNameTemplate()->render([ + 'folder' => $folder, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_service_service_level_objective resource. + * + * @param string $folder + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted folder_service_service_level_objective resource. + */ + public static function folderServiceServiceLevelObjectiveName($folder, $service, $serviceLevelObjective) + { + return self::getFolderServiceServiceLevelObjectiveNameTemplate()->render([ + 'folder' => $folder, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_service resource. + * + * @param string $organization + * @param string $service + * + * @return string The formatted organization_service resource. + */ + public static function organizationServiceName($organization, $service) + { + return self::getOrganizationServiceNameTemplate()->render([ + 'organization' => $organization, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_service_service_level_objective resource. + * + * @param string $organization + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted organization_service_service_level_objective resource. + */ + public static function organizationServiceServiceLevelObjectiveName($organization, $service, $serviceLevelObjective) + { + return self::getOrganizationServiceServiceLevelObjectiveNameTemplate()->render([ + 'organization' => $organization, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_service resource. + * + * @param string $project + * @param string $service + * + * @return string The formatted project_service resource. + */ + public static function projectServiceName($project, $service) + { + return self::getProjectServiceNameTemplate()->render([ + 'project' => $project, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_service_service_level_objective resource. + * + * @param string $project + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted project_service_service_level_objective resource. + */ + public static function projectServiceServiceLevelObjectiveName($project, $service, $serviceLevelObjective) + { + return self::getProjectServiceServiceLevelObjectiveNameTemplate()->render([ + 'project' => $project, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * service_level_objective resource. + * + * @param string $project + * @param string $service + * @param string $serviceLevelObjective + * + * @return string The formatted service_level_objective resource. + */ + public static function serviceLevelObjectiveName($project, $service, $serviceLevelObjective) + { + return self::getServiceLevelObjectiveNameTemplate()->render([ + 'project' => $project, + 'service' => $service, + 'service_level_objective' => $serviceLevelObjective, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderService: folders/{folder}/services/{service} + * - folderServiceServiceLevelObjective: folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - organizationService: organizations/{organization}/services/{service} + * - organizationServiceServiceLevelObjective: organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - projectService: projects/{project}/services/{service} + * - projectServiceServiceLevelObjective: projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective} + * - service: projects/{project}/services/{service} + * - serviceLevelObjective: projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Create a `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $parent = 'parent'; + * $service = new Service(); + * $response = $serviceMonitoringServiceClient->createService($parent, $service); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param Service $service Required. The `Service` to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $serviceId + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Service + * + * @throws ApiException if the remote call fails + */ + public function createService($parent, $service, array $optionalArgs = []) + { + $request = new CreateServiceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setService($service); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['serviceId'])) { + $request->setServiceId($optionalArgs['serviceId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Create a `ServiceLevelObjective` for the given `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedParent = $serviceMonitoringServiceClient->serviceName('[PROJECT]', '[SERVICE]'); + * $serviceLevelObjective = new ServiceLevelObjective(); + * $response = $serviceMonitoringServiceClient->createServiceLevelObjective($formattedParent, $serviceLevelObjective); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the parent `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param ServiceLevelObjective $serviceLevelObjective Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * @param array $optionalArgs { + * Optional. + * + * @type string $serviceLevelObjectiveId + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\ServiceLevelObjective + * + * @throws ApiException if the remote call fails + */ + public function createServiceLevelObjective($parent, $serviceLevelObjective, array $optionalArgs = []) + { + $request = new CreateServiceLevelObjectiveRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setServiceLevelObjective($serviceLevelObjective); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['serviceLevelObjectiveId'])) { + $request->setServiceLevelObjectiveId($optionalArgs['serviceLevelObjectiveId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateServiceLevelObjective', ServiceLevelObjective::class, $optionalArgs, $request)->wait(); + } + + /** + * Soft delete this `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedName = $serviceMonitoringServiceClient->serviceName('[PROJECT]', '[SERVICE]'); + * $serviceMonitoringServiceClient->deleteService($formattedName); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the `Service` to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteService($name, array $optionalArgs = []) + { + $request = new DeleteServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteService', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Delete the given `ServiceLevelObjective`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedName = $serviceMonitoringServiceClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + * $serviceMonitoringServiceClient->deleteServiceLevelObjective($formattedName); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteServiceLevelObjective($name, array $optionalArgs = []) + { + $request = new DeleteServiceLevelObjectiveRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteServiceLevelObjective', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Get the named `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedName = $serviceMonitoringServiceClient->serviceName('[PROJECT]', '[SERVICE]'); + * $response = $serviceMonitoringServiceClient->getService($formattedName); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Service + * + * @throws ApiException if the remote call fails + */ + public function getService($name, array $optionalArgs = []) + { + $request = new GetServiceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Get a `ServiceLevelObjective` by name. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedName = $serviceMonitoringServiceClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + * $response = $serviceMonitoringServiceClient->getServiceLevelObjective($formattedName); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * For allowed values, use constants defined on {@see \Google\Cloud\Monitoring\V3\ServiceLevelObjective\View} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\ServiceLevelObjective + * + * @throws ApiException if the remote call fails + */ + public function getServiceLevelObjective($name, array $optionalArgs = []) + { + $request = new GetServiceLevelObjectiveRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetServiceLevelObjective', ServiceLevelObjective::class, $optionalArgs, $request)->wait(); + } + + /** + * List the `ServiceLevelObjective`s for the given `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $formattedParent = $serviceMonitoringServiceClient->serviceName('[PROJECT]', '[SERVICE]'); + * // Iterate over pages of elements + * $pagedResponse = $serviceMonitoringServiceClient->listServiceLevelObjectives($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $serviceMonitoringServiceClient->listServiceLevelObjectives($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * For allowed values, use constants defined on {@see \Google\Cloud\Monitoring\V3\ServiceLevelObjective\View} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listServiceLevelObjectives($parent, array $optionalArgs = []) + { + $request = new ListServiceLevelObjectivesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServiceLevelObjectives', $optionalArgs, ListServiceLevelObjectivesResponse::class, $request); + } + + /** + * List `Service`s for this Metrics Scope. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $parent = 'parent'; + * // Iterate over pages of elements + * $pagedResponse = $serviceMonitoringServiceClient->listServices($parent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $serviceMonitoringServiceClient->listServices($parent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listServices($parent, array $optionalArgs = []) + { + $request = new ListServicesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListServices', $optionalArgs, ListServicesResponse::class, $request); + } + + /** + * Update this `Service`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $service = new Service(); + * $response = $serviceMonitoringServiceClient->updateService($service); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param Service $service Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * A set of field paths defining which fields to use for the update. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Service + * + * @throws ApiException if the remote call fails + */ + public function updateService($service, array $optionalArgs = []) + { + $request = new UpdateServiceRequest(); + $requestParamHeaders = []; + $request->setService($service); + $requestParamHeaders['service.name'] = $service->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateService', Service::class, $optionalArgs, $request)->wait(); + } + + /** + * Update the given `ServiceLevelObjective`. + * + * Sample code: + * ``` + * $serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + * try { + * $serviceLevelObjective = new ServiceLevelObjective(); + * $response = $serviceMonitoringServiceClient->updateServiceLevelObjective($serviceLevelObjective); + * } finally { + * $serviceMonitoringServiceClient->close(); + * } + * ``` + * + * @param ServiceLevelObjective $serviceLevelObjective Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * A set of field paths defining which fields to use for the update. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\ServiceLevelObjective + * + * @throws ApiException if the remote call fails + */ + public function updateServiceLevelObjective($serviceLevelObjective, array $optionalArgs = []) + { + $request = new UpdateServiceLevelObjectiveRequest(); + $requestParamHeaders = []; + $request->setServiceLevelObjective($serviceLevelObjective); + $requestParamHeaders['service_level_objective.name'] = $serviceLevelObjective->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateServiceLevelObjective', ServiceLevelObjective::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/SnoozeServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/SnoozeServiceGapicClient.php new file mode 100644 index 000000000000..08c130e17a09 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/SnoozeServiceGapicClient.php @@ -0,0 +1,680 @@ +workspaceName('[PROJECT]'); + * $snooze = new Snooze(); + * $response = $snoozeServiceClient->createSnooze($formattedParent, $snooze); + * } finally { + * $snoozeServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\SnoozeServiceClient}. + */ +class SnoozeServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.SnoozeService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $alertPolicyNameTemplate; + + private static $folderAlertPolicyNameTemplate; + + private static $organizationAlertPolicyNameTemplate; + + private static $projectNameTemplate; + + private static $projectAlertPolicyNameTemplate; + + private static $snoozeNameTemplate; + + private static $workspaceNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/snooze_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/snooze_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/snooze_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/snooze_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getAlertPolicyNameTemplate() + { + if (self::$alertPolicyNameTemplate == null) { + self::$alertPolicyNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}'); + } + + return self::$alertPolicyNameTemplate; + } + + private static function getFolderAlertPolicyNameTemplate() + { + if (self::$folderAlertPolicyNameTemplate == null) { + self::$folderAlertPolicyNameTemplate = new PathTemplate('folders/{folder}/alertPolicies/{alert_policy}'); + } + + return self::$folderAlertPolicyNameTemplate; + } + + private static function getOrganizationAlertPolicyNameTemplate() + { + if (self::$organizationAlertPolicyNameTemplate == null) { + self::$organizationAlertPolicyNameTemplate = new PathTemplate('organizations/{organization}/alertPolicies/{alert_policy}'); + } + + return self::$organizationAlertPolicyNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getProjectAlertPolicyNameTemplate() + { + if (self::$projectAlertPolicyNameTemplate == null) { + self::$projectAlertPolicyNameTemplate = new PathTemplate('projects/{project}/alertPolicies/{alert_policy}'); + } + + return self::$projectAlertPolicyNameTemplate; + } + + private static function getSnoozeNameTemplate() + { + if (self::$snoozeNameTemplate == null) { + self::$snoozeNameTemplate = new PathTemplate('projects/{project}/snoozes/{snooze}'); + } + + return self::$snoozeNameTemplate; + } + + private static function getWorkspaceNameTemplate() + { + if (self::$workspaceNameTemplate == null) { + self::$workspaceNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$workspaceNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'alertPolicy' => self::getAlertPolicyNameTemplate(), + 'folderAlertPolicy' => self::getFolderAlertPolicyNameTemplate(), + 'organizationAlertPolicy' => self::getOrganizationAlertPolicyNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'projectAlertPolicy' => self::getProjectAlertPolicyNameTemplate(), + 'snooze' => self::getSnoozeNameTemplate(), + 'workspace' => self::getWorkspaceNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a alert_policy + * resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted alert_policy resource. + */ + public static function alertPolicyName($project, $alertPolicy) + { + return self::getAlertPolicyNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_alert_policy resource. + * + * @param string $folder + * @param string $alertPolicy + * + * @return string The formatted folder_alert_policy resource. + */ + public static function folderAlertPolicyName($folder, $alertPolicy) + { + return self::getFolderAlertPolicyNameTemplate()->render([ + 'folder' => $folder, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_alert_policy resource. + * + * @param string $organization + * @param string $alertPolicy + * + * @return string The formatted organization_alert_policy resource. + */ + public static function organizationAlertPolicyName($organization, $alertPolicy) + { + return self::getOrganizationAlertPolicyNameTemplate()->render([ + 'organization' => $organization, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_alert_policy resource. + * + * @param string $project + * @param string $alertPolicy + * + * @return string The formatted project_alert_policy resource. + */ + public static function projectAlertPolicyName($project, $alertPolicy) + { + return self::getProjectAlertPolicyNameTemplate()->render([ + 'project' => $project, + 'alert_policy' => $alertPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a snooze + * resource. + * + * @param string $project + * @param string $snooze + * + * @return string The formatted snooze resource. + */ + public static function snoozeName($project, $snooze) + { + return self::getSnoozeNameTemplate()->render([ + 'project' => $project, + 'snooze' => $snooze, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workspace + * resource. + * + * @param string $project + * + * @return string The formatted workspace resource. + */ + public static function workspaceName($project) + { + return self::getWorkspaceNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - alertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - folderAlertPolicy: folders/{folder}/alertPolicies/{alert_policy} + * - organizationAlertPolicy: organizations/{organization}/alertPolicies/{alert_policy} + * - project: projects/{project} + * - projectAlertPolicy: projects/{project}/alertPolicies/{alert_policy} + * - snooze: projects/{project}/snoozes/{snooze} + * - workspace: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a `Snooze` that will prevent alerts, which match the provided + * criteria, from being opened. The `Snooze` applies for a specific time + * interval. + * + * Sample code: + * ``` + * $snoozeServiceClient = new SnoozeServiceClient(); + * try { + * $formattedParent = $snoozeServiceClient->workspaceName('[PROJECT]'); + * $snooze = new Snooze(); + * $response = $snoozeServiceClient->createSnooze($formattedParent, $snooze); + * } finally { + * $snoozeServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param Snooze $snooze Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Snooze + * + * @throws ApiException if the remote call fails + */ + public function createSnooze($parent, $snooze, array $optionalArgs = []) + { + $request = new CreateSnoozeRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSnooze($snooze); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSnooze', Snooze::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `Snooze` by `name`. + * + * Sample code: + * ``` + * $snoozeServiceClient = new SnoozeServiceClient(); + * try { + * $formattedName = $snoozeServiceClient->snoozeName('[PROJECT]', '[SNOOZE]'); + * $response = $snoozeServiceClient->getSnooze($formattedName); + * } finally { + * $snoozeServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The ID of the `Snooze` to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Snooze + * + * @throws ApiException if the remote call fails + */ + public function getSnooze($name, array $optionalArgs = []) + { + $request = new GetSnoozeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSnooze', Snooze::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the `Snooze`s associated with a project. Can optionally pass in + * `filter`, which specifies predicates to match `Snooze`s. + * + * Sample code: + * ``` + * $snoozeServiceClient = new SnoozeServiceClient(); + * try { + * $formattedParent = $snoozeServiceClient->workspaceName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $snoozeServiceClient->listSnoozes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $snoozeServiceClient->listSnoozes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $snoozeServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * + * * `interval.start_time` + * * `interval.end_time` + * + * For example: + * + * ``` + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * ``` + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSnoozes($parent, array $optionalArgs = []) + { + $request = new ListSnoozesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSnoozes', $optionalArgs, ListSnoozesResponse::class, $request); + } + + /** + * Updates a `Snooze`, identified by its `name`, with the parameters in the + * given `Snooze` object. + * + * Sample code: + * ``` + * $snoozeServiceClient = new SnoozeServiceClient(); + * try { + * $snooze = new Snooze(); + * $updateMask = new FieldMask(); + * $response = $snoozeServiceClient->updateSnooze($snooze, $updateMask); + * } finally { + * $snoozeServiceClient->close(); + * } + * ``` + * + * @param Snooze $snooze Required. The `Snooze` to update. Must have the name field present. + * @param FieldMask $updateMask Required. The fields to update. + * + * For each field listed in `update_mask`: + * + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * + * Fields not listed retain their existing value. + * + * The following are the field names that are accepted in `update_mask`: + * + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\Snooze + * + * @throws ApiException if the remote call fails + */ + public function updateSnooze($snooze, $updateMask, array $optionalArgs = []) + { + $request = new UpdateSnoozeRequest(); + $requestParamHeaders = []; + $request->setSnooze($snooze); + $request->setUpdateMask($updateMask); + $requestParamHeaders['snooze.name'] = $snooze->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSnooze', Snooze::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/Gapic/UptimeCheckServiceGapicClient.php b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/UptimeCheckServiceGapicClient.php new file mode 100644 index 000000000000..1cb01a5525fb --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/Gapic/UptimeCheckServiceGapicClient.php @@ -0,0 +1,724 @@ +createUptimeCheckConfig($parent, $uptimeCheckConfig); + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Monitoring\V3\Client\UptimeCheckServiceClient}. + */ +class UptimeCheckServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.monitoring.v3.UptimeCheckService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'monitoring.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'monitoring.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + + private static $folderUptimeCheckConfigNameTemplate; + + private static $functionNameTemplate; + + private static $organizationUptimeCheckConfigNameTemplate; + + private static $projectUptimeCheckConfigNameTemplate; + + private static $uptimeCheckConfigNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/uptime_check_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/uptime_check_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/uptime_check_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/uptime_check_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getFolderUptimeCheckConfigNameTemplate() + { + if (self::$folderUptimeCheckConfigNameTemplate == null) { + self::$folderUptimeCheckConfigNameTemplate = new PathTemplate('folders/{folder}/uptimeCheckConfigs/{uptime_check_config}'); + } + + return self::$folderUptimeCheckConfigNameTemplate; + } + + private static function getFunctionNameTemplate() + { + if (self::$functionNameTemplate == null) { + self::$functionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/functions/{function}'); + } + + return self::$functionNameTemplate; + } + + private static function getOrganizationUptimeCheckConfigNameTemplate() + { + if (self::$organizationUptimeCheckConfigNameTemplate == null) { + self::$organizationUptimeCheckConfigNameTemplate = new PathTemplate('organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}'); + } + + return self::$organizationUptimeCheckConfigNameTemplate; + } + + private static function getProjectUptimeCheckConfigNameTemplate() + { + if (self::$projectUptimeCheckConfigNameTemplate == null) { + self::$projectUptimeCheckConfigNameTemplate = new PathTemplate('projects/{project}/uptimeCheckConfigs/{uptime_check_config}'); + } + + return self::$projectUptimeCheckConfigNameTemplate; + } + + private static function getUptimeCheckConfigNameTemplate() + { + if (self::$uptimeCheckConfigNameTemplate == null) { + self::$uptimeCheckConfigNameTemplate = new PathTemplate('projects/{project}/uptimeCheckConfigs/{uptime_check_config}'); + } + + return self::$uptimeCheckConfigNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'folderUptimeCheckConfig' => self::getFolderUptimeCheckConfigNameTemplate(), + 'function' => self::getFunctionNameTemplate(), + 'organizationUptimeCheckConfig' => self::getOrganizationUptimeCheckConfigNameTemplate(), + 'projectUptimeCheckConfig' => self::getProjectUptimeCheckConfigNameTemplate(), + 'uptimeCheckConfig' => self::getUptimeCheckConfigNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_uptime_check_config resource. + * + * @param string $folder + * @param string $uptimeCheckConfig + * + * @return string The formatted folder_uptime_check_config resource. + */ + public static function folderUptimeCheckConfigName($folder, $uptimeCheckConfig) + { + return self::getFolderUptimeCheckConfigNameTemplate()->render([ + 'folder' => $folder, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a function + * resource. + * + * @param string $project + * @param string $location + * @param string $function + * + * @return string The formatted function resource. + */ + public static function functionName($project, $location, $function) + { + return self::getFunctionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'function' => $function, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_uptime_check_config resource. + * + * @param string $organization + * @param string $uptimeCheckConfig + * + * @return string The formatted organization_uptime_check_config resource. + */ + public static function organizationUptimeCheckConfigName($organization, $uptimeCheckConfig) + { + return self::getOrganizationUptimeCheckConfigNameTemplate()->render([ + 'organization' => $organization, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_uptime_check_config resource. + * + * @param string $project + * @param string $uptimeCheckConfig + * + * @return string The formatted project_uptime_check_config resource. + */ + public static function projectUptimeCheckConfigName($project, $uptimeCheckConfig) + { + return self::getProjectUptimeCheckConfigNameTemplate()->render([ + 'project' => $project, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * uptime_check_config resource. + * + * @param string $project + * @param string $uptimeCheckConfig + * + * @return string The formatted uptime_check_config resource. + */ + public static function uptimeCheckConfigName($project, $uptimeCheckConfig) + { + return self::getUptimeCheckConfigNameTemplate()->render([ + 'project' => $project, + 'uptime_check_config' => $uptimeCheckConfig, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - folderUptimeCheckConfig: folders/{folder}/uptimeCheckConfigs/{uptime_check_config} + * - function: projects/{project}/locations/{location}/functions/{function} + * - organizationUptimeCheckConfig: organizations/{organization}/uptimeCheckConfigs/{uptime_check_config} + * - projectUptimeCheckConfig: projects/{project}/uptimeCheckConfigs/{uptime_check_config} + * - uptimeCheckConfig: projects/{project}/uptimeCheckConfigs/{uptime_check_config} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'monitoring.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new Uptime check configuration. + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * $parent = 'parent'; + * $uptimeCheckConfig = new UptimeCheckConfig(); + * $response = $uptimeCheckServiceClient->createUptimeCheckConfig($parent, $uptimeCheckConfig); + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param UptimeCheckConfig $uptimeCheckConfig Required. The new Uptime check configuration. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig + * + * @throws ApiException if the remote call fails + */ + public function createUptimeCheckConfig($parent, $uptimeCheckConfig, array $optionalArgs = []) + { + $request = new CreateUptimeCheckConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setUptimeCheckConfig($uptimeCheckConfig); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateUptimeCheckConfig', UptimeCheckConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an Uptime check configuration. Note that this method will fail + * if the Uptime check configuration is referenced by an alert policy or + * other dependent configs that would be rendered invalid by the deletion. + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * $formattedName = $uptimeCheckServiceClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + * $uptimeCheckServiceClient->deleteUptimeCheckConfig($formattedName); + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The Uptime check configuration to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteUptimeCheckConfig($name, array $optionalArgs = []) + { + $request = new DeleteUptimeCheckConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteUptimeCheckConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single Uptime check configuration. + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * $formattedName = $uptimeCheckServiceClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + * $response = $uptimeCheckServiceClient->getUptimeCheckConfig($formattedName); + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The Uptime check configuration to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig + * + * @throws ApiException if the remote call fails + */ + public function getUptimeCheckConfig($name, array $optionalArgs = []) + { + $request = new GetUptimeCheckConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetUptimeCheckConfig', UptimeCheckConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the existing valid Uptime check configurations for the project + * (leaving out any invalid configurations). + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * $parent = 'parent'; + * // Iterate over pages of elements + * $pagedResponse = $uptimeCheckServiceClient->listUptimeCheckConfigs($parent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $uptimeCheckServiceClient->listUptimeCheckConfigs($parent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listUptimeCheckConfigs($parent, array $optionalArgs = []) + { + $request = new ListUptimeCheckConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListUptimeCheckConfigs', $optionalArgs, ListUptimeCheckConfigsResponse::class, $request); + } + + /** + * Returns the list of IP addresses that checkers run from. + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $uptimeCheckServiceClient->listUptimeCheckIps(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $uptimeCheckServiceClient->listUptimeCheckIps(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listUptimeCheckIps(array $optionalArgs = []) + { + $request = new ListUptimeCheckIpsRequest(); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + return $this->getPagedListResponse('ListUptimeCheckIps', $optionalArgs, ListUptimeCheckIpsResponse::class, $request); + } + + /** + * Updates an Uptime check configuration. You can either replace the entire + * configuration with a new one or replace only certain fields in the current + * configuration by specifying the fields to be updated via `updateMask`. + * Returns the updated configuration. + * + * Sample code: + * ``` + * $uptimeCheckServiceClient = new UptimeCheckServiceClient(); + * try { + * $uptimeCheckConfig = new UptimeCheckConfig(); + * $response = $uptimeCheckServiceClient->updateUptimeCheckConfig($uptimeCheckConfig); + * } finally { + * $uptimeCheckServiceClient->close(); + * } + * ``` + * + * @param UptimeCheckConfig $uptimeCheckConfig Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Monitoring\V3\UptimeCheckConfig + * + * @throws ApiException if the remote call fails + */ + public function updateUptimeCheckConfig($uptimeCheckConfig, array $optionalArgs = []) + { + $request = new UpdateUptimeCheckConfigRequest(); + $requestParamHeaders = []; + $request->setUptimeCheckConfig($uptimeCheckConfig); + $requestParamHeaders['uptime_check_config.name'] = $uptimeCheckConfig->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateUptimeCheckConfig', UptimeCheckConfig::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/GroupServiceClient.php b/owl-bot-staging/Monitoring/v3/src/V3/GroupServiceClient.php new file mode 100644 index 000000000000..c8b5d43074ef --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/GroupServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.monitoring.v3.AlertPolicyService' => [ + 'CreateAlertPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\AlertPolicy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAlertPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAlertPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\AlertPolicy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAlertPolicies' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAlertPolicies', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListAlertPoliciesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateAlertPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\AlertPolicy', + 'headerParams' => [ + [ + 'keyName' => 'alert_policy.name', + 'fieldAccessors' => [ + 'getAlertPolicy', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'alertPolicy' => 'projects/{project}/alertPolicies/{alert_policy}', + 'alertPolicyCondition' => 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', + 'folderAlertPolicy' => 'folders/{folder}/alertPolicies/{alert_policy}', + 'folderAlertPolicyCondition' => 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', + 'organizationAlertPolicy' => 'organizations/{organization}/alertPolicies/{alert_policy}', + 'organizationAlertPolicyCondition' => 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + 'projectAlertPolicy' => 'projects/{project}/alertPolicies/{alert_policy}', + 'projectAlertPolicyCondition' => 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_rest_client_config.php new file mode 100644 index 000000000000..bb65ee95b1d7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/alert_policy_service_rest_client_config.php @@ -0,0 +1,87 @@ + [ + 'google.monitoring.v3.AlertPolicyService' => [ + 'CreateAlertPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/alertPolicies', + 'body' => 'alert_policy', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAlertPolicy' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/alertPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAlertPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/alertPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAlertPolicies' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/alertPolicies', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateAlertPolicy' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{alert_policy.name=projects/*/alertPolicies/*}', + 'body' => 'alert_policy', + 'placeholders' => [ + 'alert_policy.name' => [ + 'getters' => [ + 'getAlertPolicy', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_client_config.json new file mode 100644 index 000000000000..3701e6baf28a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_client_config.json @@ -0,0 +1,86 @@ +{ + "interfaces": { + "google.monitoring.v3.GroupService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ], + "no_retry_2_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 180000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 180000, + "total_timeout_millis": 180000 + }, + "no_retry_2_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateGroup": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "DeleteGroup": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetGroup": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListGroupMembers": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListGroups": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateGroup": { + "timeout_millis": 180000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_descriptor_config.php new file mode 100644 index 000000000000..dba3498cf7f6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_descriptor_config.php @@ -0,0 +1,123 @@ + [ + 'google.monitoring.v3.GroupService' => [ + 'CreateGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Group', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Group', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListGroupMembers' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMembers', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListGroupMembersResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListGroups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGroup', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListGroupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Group', + 'headerParams' => [ + [ + 'keyName' => 'group.name', + 'fieldAccessors' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folderGroup' => 'folders/{folder}/groups/{group}', + 'group' => 'projects/{project}/groups/{group}', + 'organizationGroup' => 'organizations/{organization}/groups/{group}', + 'projectGroup' => 'projects/{project}/groups/{group}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_rest_client_config.php new file mode 100644 index 000000000000..1ec3e238ee16 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/group_service_rest_client_config.php @@ -0,0 +1,98 @@ + [ + 'google.monitoring.v3.GroupService' => [ + 'CreateGroup' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/groups', + 'body' => 'group', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGroup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/groups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGroup' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/groups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListGroupMembers' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/groups/*}/members', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListGroups' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/groups', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'method' => 'put', + 'uriTemplate' => '/v3/{group.name=projects/*/groups/*}', + 'body' => 'group', + 'placeholders' => [ + 'group.name' => [ + 'getters' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_client_config.json new file mode 100644 index 000000000000..37d238c05841 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_client_config.json @@ -0,0 +1,101 @@ +{ + "interfaces": { + "google.monitoring.v3.MetricService": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_3_codes": [], + "retry_policy_7_codes": [ + "UNAVAILABLE" + ], + "retry_policy_8_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_3_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 12000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 12000, + "total_timeout_millis": 12000 + }, + "retry_policy_7_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "retry_policy_8_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 90000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 90000, + "total_timeout_millis": 90000 + } + }, + "methods": { + "CreateMetricDescriptor": { + "timeout_millis": 12000, + "retry_codes_name": "no_retry_3_codes", + "retry_params_name": "no_retry_3_params" + }, + "CreateServiceTimeSeries": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateTimeSeries": { + "timeout_millis": 12000, + "retry_codes_name": "no_retry_3_codes", + "retry_params_name": "no_retry_3_params" + }, + "DeleteMetricDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "GetMetricDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "GetMonitoredResourceDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "ListMetricDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "ListMonitoredResourceDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_7_codes", + "retry_params_name": "retry_policy_7_params" + }, + "ListTimeSeries": { + "timeout_millis": 90000, + "retry_codes_name": "retry_policy_8_codes", + "retry_params_name": "retry_policy_8_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_descriptor_config.php new file mode 100644 index 000000000000..7b8896801ebc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_descriptor_config.php @@ -0,0 +1,174 @@ + [ + 'google.monitoring.v3.MetricService' => [ + 'CreateMetricDescriptor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\MetricDescriptor', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateServiceTimeSeries' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateTimeSeries' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMetricDescriptor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMetricDescriptor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\MetricDescriptor', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMonitoredResourceDescriptor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Api\MonitoredResourceDescriptor', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListMetricDescriptors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMetricDescriptors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListMetricDescriptorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListMonitoredResourceDescriptors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getResourceDescriptors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListMonitoredResourceDescriptorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListTimeSeries' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTimeSeries', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListTimeSeriesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folder' => 'folders/{folder}', + 'folderMetricDescriptor' => 'folders/{folder}/metricDescriptors/{metric_descriptor=**}', + 'folderMonitoredResourceDescriptor' => 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + 'metricDescriptor' => 'projects/{project}/metricDescriptors/{metric_descriptor=**}', + 'monitoredResourceDescriptor' => 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + 'organization' => 'organizations/{organization}', + 'organizationMetricDescriptor' => 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}', + 'organizationMonitoredResourceDescriptor' => 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + 'project' => 'projects/{project}', + 'projectMetricDescriptor' => 'projects/{project}/metricDescriptors/{metric_descriptor=**}', + 'projectMonitoredResourceDescriptor' => 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + 'workspace' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_rest_client_config.php new file mode 100644 index 000000000000..0367626add51 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/metric_service_rest_client_config.php @@ -0,0 +1,156 @@ + [ + 'google.monitoring.v3.MetricService' => [ + 'CreateMetricDescriptor' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/metricDescriptors', + 'body' => 'metric_descriptor', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateServiceTimeSeries' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/timeSeries:createService', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateTimeSeries' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/timeSeries', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMetricDescriptor' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/metricDescriptors/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMetricDescriptor' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/metricDescriptors/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMonitoredResourceDescriptor' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/monitoredResourceDescriptors/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListMetricDescriptors' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/metricDescriptors', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListMonitoredResourceDescriptors' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/monitoredResourceDescriptors', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListTimeSeries' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/timeSeries', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=organizations/*}/timeSeries', + 'queryParams' => [ + 'filter', + 'interval', + 'view', + ], + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=folders/*}/timeSeries', + 'queryParams' => [ + 'filter', + 'interval', + 'view', + ], + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + 'queryParams' => [ + 'filter', + 'interval', + 'view', + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_client_config.json new file mode 100644 index 000000000000..90437e7f64c3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_client_config.json @@ -0,0 +1,94 @@ +{ + "interfaces": { + "google.monitoring.v3.NotificationChannelService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_3_codes": [ + "UNAVAILABLE" + ], + "no_retry_5_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_3_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "no_retry_5_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_5_codes", + "retry_params_name": "no_retry_5_params" + }, + "DeleteNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetNotificationChannelDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetNotificationChannelVerificationCode": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListNotificationChannelDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListNotificationChannels": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "SendNotificationChannelVerificationCode": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_5_codes", + "retry_params_name": "no_retry_5_params" + }, + "UpdateNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_5_codes", + "retry_params_name": "no_retry_5_params" + }, + "VerifyNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_descriptor_config.php new file mode 100644 index 000000000000..6088b2f89bf7 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_descriptor_config.php @@ -0,0 +1,175 @@ + [ + 'google.monitoring.v3.NotificationChannelService' => [ + 'CreateNotificationChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\NotificationChannel', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNotificationChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\NotificationChannel', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannelDescriptor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\NotificationChannelDescriptor', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannelVerificationCode' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\GetNotificationChannelVerificationCodeResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListNotificationChannelDescriptors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getChannelDescriptors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListNotificationChannelDescriptorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListNotificationChannels' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNotificationChannels', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListNotificationChannelsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'SendNotificationChannelVerificationCode' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateNotificationChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\NotificationChannel', + 'headerParams' => [ + [ + 'keyName' => 'notification_channel.name', + 'fieldAccessors' => [ + 'getNotificationChannel', + 'getName', + ], + ], + ], + ], + 'VerifyNotificationChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\NotificationChannel', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folderChannelDescriptor' => 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', + 'folderNotificationChannel' => 'folders/{folder}/notificationChannels/{notification_channel}', + 'notificationChannel' => 'projects/{project}/notificationChannels/{notification_channel}', + 'notificationChannelDescriptor' => 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', + 'organizationChannelDescriptor' => 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + 'organizationNotificationChannel' => 'organizations/{organization}/notificationChannels/{notification_channel}', + 'projectChannelDescriptor' => 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', + 'projectNotificationChannel' => 'projects/{project}/notificationChannels/{notification_channel}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_rest_client_config.php new file mode 100644 index 000000000000..822c7ebc9340 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/notification_channel_service_rest_client_config.php @@ -0,0 +1,145 @@ + [ + 'google.monitoring.v3.NotificationChannelService' => [ + 'CreateNotificationChannel' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/notificationChannels', + 'body' => 'notification_channel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNotificationChannel' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannels/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannel' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannels/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannelDescriptor' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannelDescriptors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNotificationChannelVerificationCode' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannels/*}:getVerificationCode', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListNotificationChannelDescriptors' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/notificationChannelDescriptors', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListNotificationChannels' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/notificationChannels', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'SendNotificationChannelVerificationCode' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateNotificationChannel' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{notification_channel.name=projects/*/notificationChannels/*}', + 'body' => 'notification_channel', + 'placeholders' => [ + 'notification_channel.name' => [ + 'getters' => [ + 'getNotificationChannel', + 'getName', + ], + ], + ], + ], + 'VerifyNotificationChannel' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/notificationChannels/*}:verify', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_client_config.json new file mode 100644 index 000000000000..c20408d0eced --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_client_config.json @@ -0,0 +1,27 @@ +{ + "interfaces": { + "google.monitoring.v3.QueryService": { + "retry_codes": { + "no_retry_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + } + }, + "methods": { + "QueryTimeSeries": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_descriptor_config.php new file mode 100644 index 000000000000..4b6dc680ebc6 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_descriptor_config.php @@ -0,0 +1,48 @@ + [ + 'google.monitoring.v3.QueryService' => [ + 'QueryTimeSeries' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTimeSeriesData', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\QueryTimeSeriesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_rest_client_config.php new file mode 100644 index 000000000000..38b688dbab52 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/query_service_rest_client_config.php @@ -0,0 +1,41 @@ + [ + 'google.monitoring.v3.QueryService' => [ + 'QueryTimeSeries' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*}/timeSeries:query', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_client_config.json new file mode 100644 index 000000000000..daae71bdd457 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_client_config.json @@ -0,0 +1,94 @@ +{ + "interfaces": { + "google.monitoring.v3.ServiceMonitoringService": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_4_codes": [], + "retry_policy_4_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_4_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "retry_policy_4_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateService": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "CreateServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "DeleteService": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "DeleteServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "GetService": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "GetServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "ListServiceLevelObjectives": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "ListServices": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "UpdateService": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "UpdateServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_descriptor_config.php new file mode 100644 index 000000000000..739ca8709340 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_descriptor_config.php @@ -0,0 +1,176 @@ + [ + 'google.monitoring.v3.ServiceMonitoringService' => [ + 'CreateService' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Service', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateServiceLevelObjective' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ServiceLevelObjective', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteService' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteServiceLevelObjective' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Service', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetServiceLevelObjective' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ServiceLevelObjective', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListServiceLevelObjectives' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServiceLevelObjectives', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListServiceLevelObjectivesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getServices', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListServicesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateService' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Service', + 'headerParams' => [ + [ + 'keyName' => 'service.name', + 'fieldAccessors' => [ + 'getService', + 'getName', + ], + ], + ], + ], + 'UpdateServiceLevelObjective' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ServiceLevelObjective', + 'headerParams' => [ + [ + 'keyName' => 'service_level_objective.name', + 'fieldAccessors' => [ + 'getServiceLevelObjective', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folderService' => 'folders/{folder}/services/{service}', + 'folderServiceServiceLevelObjective' => 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + 'organizationService' => 'organizations/{organization}/services/{service}', + 'organizationServiceServiceLevelObjective' => 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + 'projectService' => 'projects/{project}/services/{service}', + 'projectServiceServiceLevelObjective' => 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + 'service' => 'projects/{project}/services/{service}', + 'serviceLevelObjective' => 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_rest_client_config.php new file mode 100644 index 000000000000..f7ca03dded7a --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/service_monitoring_service_rest_client_config.php @@ -0,0 +1,145 @@ + [ + 'google.monitoring.v3.ServiceMonitoringService' => [ + 'CreateService' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=*/*}/services', + 'body' => 'service', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateServiceLevelObjective' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=*/*/services/*}/serviceLevelObjectives', + 'body' => 'service_level_objective', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteService' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=*/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteServiceLevelObjective' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=*/*/services/*/serviceLevelObjectives/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetService' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=*/*/services/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetServiceLevelObjective' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=*/*/services/*/serviceLevelObjectives/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListServiceLevelObjectives' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=*/*/services/*}/serviceLevelObjectives', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListServices' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=*/*}/services', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateService' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{service.name=*/*/services/*}', + 'body' => 'service', + 'placeholders' => [ + 'service.name' => [ + 'getters' => [ + 'getService', + 'getName', + ], + ], + ], + ], + 'UpdateServiceLevelObjective' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}', + 'body' => 'service_level_objective', + 'placeholders' => [ + 'service_level_objective.name' => [ + 'getters' => [ + 'getServiceLevelObjective', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_client_config.json new file mode 100644 index 000000000000..0acb65e12bd9 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.monitoring.v3.SnoozeService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_9_codes": [ + "UNAVAILABLE" + ], + "no_retry_7_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_9_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "no_retry_7_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateSnooze": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_7_codes", + "retry_params_name": "no_retry_7_params" + }, + "GetSnooze": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_9_codes", + "retry_params_name": "retry_policy_9_params" + }, + "ListSnoozes": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_9_codes", + "retry_params_name": "retry_policy_9_params" + }, + "UpdateSnooze": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_7_codes", + "retry_params_name": "no_retry_7_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_descriptor_config.php new file mode 100644 index 000000000000..57e5c8ab3863 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_descriptor_config.php @@ -0,0 +1,94 @@ + [ + 'google.monitoring.v3.SnoozeService' => [ + 'CreateSnooze' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Snooze', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetSnooze' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Snooze', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSnoozes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSnoozes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListSnoozesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSnooze' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\Snooze', + 'headerParams' => [ + [ + 'keyName' => 'snooze.name', + 'fieldAccessors' => [ + 'getSnooze', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'alertPolicy' => 'projects/{project}/alertPolicies/{alert_policy}', + 'folderAlertPolicy' => 'folders/{folder}/alertPolicies/{alert_policy}', + 'organizationAlertPolicy' => 'organizations/{organization}/alertPolicies/{alert_policy}', + 'project' => 'projects/{project}', + 'projectAlertPolicy' => 'projects/{project}/alertPolicies/{alert_policy}', + 'snooze' => 'projects/{project}/snoozes/{snooze}', + 'workspace' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_rest_client_config.php new file mode 100644 index 000000000000..a3b5e3574b8e --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/snooze_service_rest_client_config.php @@ -0,0 +1,79 @@ + [ + 'google.monitoring.v3.SnoozeService' => [ + 'CreateSnooze' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}/snoozes', + 'body' => 'snooze', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetSnooze' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/snoozes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSnoozes' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*}/snoozes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateSnooze' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{snooze.name=projects/*/snoozes/*}', + 'body' => 'snooze', + 'placeholders' => [ + 'snooze.name' => [ + 'getters' => [ + 'getSnooze', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_client_config.json b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_client_config.json new file mode 100644 index 000000000000..4e19af233897 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.monitoring.v3.UptimeCheckService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_5_codes": [ + "UNAVAILABLE" + ], + "no_retry_6_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_5_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "no_retry_6_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_6_codes", + "retry_params_name": "no_retry_6_params" + }, + "DeleteUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_5_codes", + "retry_params_name": "retry_policy_5_params" + }, + "GetUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_5_codes", + "retry_params_name": "retry_policy_5_params" + }, + "ListUptimeCheckConfigs": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_5_codes", + "retry_params_name": "retry_policy_5_params" + }, + "ListUptimeCheckIps": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_5_codes", + "retry_params_name": "retry_policy_5_params" + }, + "UpdateUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_6_codes", + "retry_params_name": "no_retry_6_params" + } + } + } + } +} diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_descriptor_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_descriptor_config.php new file mode 100644 index 000000000000..e1d4dafc1ca4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_descriptor_config.php @@ -0,0 +1,116 @@ + [ + 'google.monitoring.v3.UptimeCheckService' => [ + 'CreateUptimeCheckConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\UptimeCheckConfig', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteUptimeCheckConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetUptimeCheckConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\UptimeCheckConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListUptimeCheckConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getUptimeCheckConfigs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListUptimeCheckConfigsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListUptimeCheckIps' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getUptimeCheckIps', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\ListUptimeCheckIpsResponse', + ], + 'UpdateUptimeCheckConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Monitoring\V3\UptimeCheckConfig', + 'headerParams' => [ + [ + 'keyName' => 'uptime_check_config.name', + 'fieldAccessors' => [ + 'getUptimeCheckConfig', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'folderUptimeCheckConfig' => 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', + 'function' => 'projects/{project}/locations/{location}/functions/{function}', + 'organizationUptimeCheckConfig' => 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + 'projectUptimeCheckConfig' => 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', + 'uptimeCheckConfig' => 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_rest_client_config.php b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_rest_client_config.php new file mode 100644 index 000000000000..4c50c3cd46b1 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/src/V3/resources/uptime_check_service_rest_client_config.php @@ -0,0 +1,91 @@ + [ + 'google.monitoring.v3.UptimeCheckService' => [ + 'CreateUptimeCheckConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}/uptimeCheckConfigs', + 'body' => 'uptime_check_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteUptimeCheckConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/uptimeCheckConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetUptimeCheckConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/uptimeCheckConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListUptimeCheckConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*}/uptimeCheckConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListUptimeCheckIps' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/uptimeCheckIps', + ], + 'UpdateUptimeCheckConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}', + 'body' => 'uptime_check_config', + 'placeholders' => [ + 'uptime_check_config.name' => [ + 'getters' => [ + 'getUptimeCheckConfig', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/AlertPolicyServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/AlertPolicyServiceClientTest.php new file mode 100644 index 000000000000..9811f18bd6f3 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/AlertPolicyServiceClientTest.php @@ -0,0 +1,380 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AlertPolicyServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AlertPolicyServiceClient($options); + } + + /** @test */ + public function createAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $alertPolicy = new AlertPolicy(); + $response = $gapicClient->createAlertPolicy($name, $alertPolicy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/CreateAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getAlertPolicy(); + $this->assertProtobufEquals($alertPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $alertPolicy = new AlertPolicy(); + try { + $gapicClient->createAlertPolicy($name, $alertPolicy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $gapicClient->deleteAlertPolicy($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/DeleteAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + try { + $gapicClient->deleteAlertPolicy($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $response = $gapicClient->getAlertPolicy($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/GetAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + try { + $gapicClient->getAlertPolicy($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAlertPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $alertPoliciesElement = new AlertPolicy(); + $alertPolicies = [ + $alertPoliciesElement, + ]; + $expectedResponse = new ListAlertPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setAlertPolicies($alertPolicies); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listAlertPolicies($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAlertPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/ListAlertPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAlertPoliciesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listAlertPolicies($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $alertPolicy = new AlertPolicy(); + $response = $gapicClient->updateAlertPolicy($alertPolicy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/UpdateAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getAlertPolicy(); + $this->assertProtobufEquals($alertPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $alertPolicy = new AlertPolicy(); + try { + $gapicClient->updateAlertPolicy($alertPolicy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/AlertPolicyServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/AlertPolicyServiceClientTest.php new file mode 100644 index 000000000000..498d9a5be075 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/AlertPolicyServiceClientTest.php @@ -0,0 +1,442 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AlertPolicyServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AlertPolicyServiceClient($options); + } + + /** @test */ + public function createAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $alertPolicy = new AlertPolicy(); + $request = (new CreateAlertPolicyRequest()) + ->setName($name) + ->setAlertPolicy($alertPolicy); + $response = $gapicClient->createAlertPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/CreateAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getAlertPolicy(); + $this->assertProtobufEquals($alertPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $alertPolicy = new AlertPolicy(); + $request = (new CreateAlertPolicyRequest()) + ->setName($name) + ->setAlertPolicy($alertPolicy); + try { + $gapicClient->createAlertPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $request = (new DeleteAlertPolicyRequest()) + ->setName($formattedName); + $gapicClient->deleteAlertPolicy($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/DeleteAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $request = (new DeleteAlertPolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteAlertPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $request = (new GetAlertPolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->getAlertPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/GetAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->alertPolicyName('[PROJECT]', '[ALERT_POLICY]'); + $request = (new GetAlertPolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->getAlertPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAlertPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $alertPoliciesElement = new AlertPolicy(); + $alertPolicies = [ + $alertPoliciesElement, + ]; + $expectedResponse = new ListAlertPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setAlertPolicies($alertPolicies); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListAlertPoliciesRequest()) + ->setName($name); + $response = $gapicClient->listAlertPolicies($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAlertPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/ListAlertPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAlertPoliciesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListAlertPoliciesRequest()) + ->setName($name); + try { + $gapicClient->listAlertPolicies($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateAlertPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $alertPolicy = new AlertPolicy(); + $request = (new UpdateAlertPolicyRequest()) + ->setAlertPolicy($alertPolicy); + $response = $gapicClient->updateAlertPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/UpdateAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getAlertPolicy(); + $this->assertProtobufEquals($alertPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateAlertPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $alertPolicy = new AlertPolicy(); + $request = (new UpdateAlertPolicyRequest()) + ->setAlertPolicy($alertPolicy); + try { + $gapicClient->updateAlertPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAlertPolicyAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new AlertPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $alertPolicy = new AlertPolicy(); + $request = (new CreateAlertPolicyRequest()) + ->setName($name) + ->setAlertPolicy($alertPolicy); + $response = $gapicClient->createAlertPolicyAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.AlertPolicyService/CreateAlertPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getAlertPolicy(); + $this->assertProtobufEquals($alertPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/GroupServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/GroupServiceClientTest.php new file mode 100644 index 000000000000..5e7c3024f3ac --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/GroupServiceClientTest.php @@ -0,0 +1,541 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GroupServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GroupServiceClient($options); + } + + /** @test */ + public function createGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $group = new Group(); + $request = (new CreateGroupRequest()) + ->setName($name) + ->setGroup($group); + $response = $gapicClient->createGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/CreateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $group = new Group(); + $request = (new CreateGroupRequest()) + ->setName($name) + ->setGroup($group); + try { + $gapicClient->createGroup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new DeleteGroupRequest()) + ->setName($formattedName); + $gapicClient->deleteGroup($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/DeleteGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new DeleteGroupRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteGroup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setName($formattedName); + $response = $gapicClient->getGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setName($formattedName); + try { + $gapicClient->getGroup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupMembersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $membersElement = new MonitoredResource(); + $members = [ + $membersElement, + ]; + $expectedResponse = new ListGroupMembersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setMembers($members); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new ListGroupMembersRequest()) + ->setName($formattedName); + $response = $gapicClient->listGroupMembers($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMembers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/ListGroupMembers', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupMembersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $request = (new ListGroupMembersRequest()) + ->setName($formattedName); + try { + $gapicClient->listGroupMembers($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $groupElement = new Group(); + $group = [ + $groupElement, + ]; + $expectedResponse = new ListGroupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGroup($group); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListGroupsRequest()) + ->setName($name); + $response = $gapicClient->listGroups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroup()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/ListGroups', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListGroupsRequest()) + ->setName($name); + try { + $gapicClient->listGroups($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $group = new Group(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + $response = $gapicClient->updateGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/UpdateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $group = new Group(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + try { + $gapicClient->updateGroup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createGroupAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $group = new Group(); + $request = (new CreateGroupRequest()) + ->setName($name) + ->setGroup($group); + $response = $gapicClient->createGroupAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/CreateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/MetricServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/MetricServiceClientTest.php new file mode 100644 index 000000000000..8a38d03c86bc --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/MetricServiceClientTest.php @@ -0,0 +1,769 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return MetricServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new MetricServiceClient($options); + } + + /** @test */ + public function createMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $unit = 'unit3594628'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new MetricDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setUnit($unit); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $metricDescriptor = new MetricDescriptor(); + $request = (new CreateMetricDescriptorRequest()) + ->setName($name) + ->setMetricDescriptor($metricDescriptor); + $response = $gapicClient->createMetricDescriptor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getMetricDescriptor(); + $this->assertProtobufEquals($metricDescriptor, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $metricDescriptor = new MetricDescriptor(); + $request = (new CreateMetricDescriptorRequest()) + ->setName($name) + ->setMetricDescriptor($metricDescriptor); + try { + $gapicClient->createMetricDescriptor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $request = (new CreateTimeSeriesRequest()) + ->setName($formattedName) + ->setTimeSeries($timeSeries); + $gapicClient->createServiceTimeSeries($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateServiceTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getTimeSeries(); + $this->assertProtobufEquals($timeSeries, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $request = (new CreateTimeSeriesRequest()) + ->setName($formattedName) + ->setTimeSeries($timeSeries); + try { + $gapicClient->createServiceTimeSeries($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $request = (new CreateTimeSeriesRequest()) + ->setName($formattedName) + ->setTimeSeries($timeSeries); + $gapicClient->createTimeSeries($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getTimeSeries(); + $this->assertProtobufEquals($timeSeries, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $request = (new CreateTimeSeriesRequest()) + ->setName($formattedName) + ->setTimeSeries($timeSeries); + try { + $gapicClient->createTimeSeries($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $request = (new DeleteMetricDescriptorRequest()) + ->setName($formattedName); + $gapicClient->deleteMetricDescriptor($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/DeleteMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $request = (new DeleteMetricDescriptorRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteMetricDescriptor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $unit = 'unit3594628'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new MetricDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setUnit($unit); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $request = (new GetMetricDescriptorRequest()) + ->setName($formattedName); + $response = $gapicClient->getMetricDescriptor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/GetMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $request = (new GetMetricDescriptorRequest()) + ->setName($formattedName); + try { + $gapicClient->getMetricDescriptor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMonitoredResourceDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new MonitoredResourceDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); + $request = (new GetMonitoredResourceDescriptorRequest()) + ->setName($formattedName); + $response = $gapicClient->getMonitoredResourceDescriptor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/GetMonitoredResourceDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMonitoredResourceDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); + $request = (new GetMonitoredResourceDescriptorRequest()) + ->setName($formattedName); + try { + $gapicClient->getMonitoredResourceDescriptor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetricDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metricDescriptorsElement = new MetricDescriptor(); + $metricDescriptors = [ + $metricDescriptorsElement, + ]; + $expectedResponse = new ListMetricDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetricDescriptors($metricDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListMetricDescriptorsRequest()) + ->setName($name); + $response = $gapicClient->listMetricDescriptors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetricDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListMetricDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetricDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListMetricDescriptorsRequest()) + ->setName($name); + try { + $gapicClient->listMetricDescriptors($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMonitoredResourceDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $resourceDescriptorsElement = new MonitoredResourceDescriptor(); + $resourceDescriptors = [ + $resourceDescriptorsElement, + ]; + $expectedResponse = new ListMonitoredResourceDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setResourceDescriptors($resourceDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListMonitoredResourceDescriptorsRequest()) + ->setName($name); + $response = $gapicClient->listMonitoredResourceDescriptors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getResourceDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListMonitoredResourceDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMonitoredResourceDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListMonitoredResourceDescriptorsRequest()) + ->setName($name); + try { + $gapicClient->listMonitoredResourceDescriptors($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $unit = 'unit3594628'; + $timeSeriesElement = new TimeSeries(); + $timeSeries = [ + $timeSeriesElement, + ]; + $expectedResponse = new ListTimeSeriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUnit($unit); + $expectedResponse->setTimeSeries($timeSeries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]'); + $filter = 'filter-1274492040'; + $interval = new TimeInterval(); + $view = TimeSeriesView::FULL; + $request = (new ListTimeSeriesRequest()) + ->setName($formattedName) + ->setFilter($filter) + ->setInterval($interval) + ->setView($view); + $response = $gapicClient->listTimeSeries($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTimeSeries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getFilter(); + $this->assertProtobufEquals($filter, $actualValue); + $actualValue = $actualRequestObject->getInterval(); + $this->assertProtobufEquals($interval, $actualValue); + $actualValue = $actualRequestObject->getView(); + $this->assertProtobufEquals($view, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]'); + $filter = 'filter-1274492040'; + $interval = new TimeInterval(); + $view = TimeSeriesView::FULL; + $request = (new ListTimeSeriesRequest()) + ->setName($formattedName) + ->setFilter($filter) + ->setInterval($interval) + ->setView($view); + try { + $gapicClient->listTimeSeries($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMetricDescriptorAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $unit = 'unit3594628'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new MetricDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setUnit($unit); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $metricDescriptor = new MetricDescriptor(); + $request = (new CreateMetricDescriptorRequest()) + ->setName($name) + ->setMetricDescriptor($metricDescriptor); + $response = $gapicClient->createMetricDescriptorAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getMetricDescriptor(); + $this->assertProtobufEquals($metricDescriptor, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/NotificationChannelServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/NotificationChannelServiceClientTest.php new file mode 100644 index 000000000000..7a0e8fd53b02 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/NotificationChannelServiceClientTest.php @@ -0,0 +1,809 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return NotificationChannelServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new NotificationChannelServiceClient($options); + } + + /** @test */ + public function createNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $notificationChannel = new NotificationChannel(); + $request = (new CreateNotificationChannelRequest()) + ->setName($name) + ->setNotificationChannel($notificationChannel); + $response = $gapicClient->createNotificationChannel($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/CreateNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getNotificationChannel(); + $this->assertProtobufEquals($notificationChannel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $notificationChannel = new NotificationChannel(); + $request = (new CreateNotificationChannelRequest()) + ->setName($name) + ->setNotificationChannel($notificationChannel); + try { + $gapicClient->createNotificationChannel($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new DeleteNotificationChannelRequest()) + ->setName($formattedName); + $gapicClient->deleteNotificationChannel($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/DeleteNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new DeleteNotificationChannelRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteNotificationChannel($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new GetNotificationChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->getNotificationChannel($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new GetNotificationChannelRequest()) + ->setName($formattedName); + try { + $gapicClient->getNotificationChannel($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannelDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelDescriptorName('[PROJECT]', '[CHANNEL_DESCRIPTOR]'); + $request = (new GetNotificationChannelDescriptorRequest()) + ->setName($formattedName); + $response = $gapicClient->getNotificationChannelDescriptor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannelDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelDescriptorName('[PROJECT]', '[CHANNEL_DESCRIPTOR]'); + $request = (new GetNotificationChannelDescriptorRequest()) + ->setName($formattedName); + try { + $gapicClient->getNotificationChannelDescriptor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelVerificationCodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $code = 'code3059181'; + $expectedResponse = new GetNotificationChannelVerificationCodeResponse(); + $expectedResponse->setCode($code); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new GetNotificationChannelVerificationCodeRequest()) + ->setName($formattedName); + $response = $gapicClient->getNotificationChannelVerificationCode($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannelVerificationCode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelVerificationCodeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new GetNotificationChannelVerificationCodeRequest()) + ->setName($formattedName); + try { + $gapicClient->getNotificationChannelVerificationCode($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $channelDescriptorsElement = new NotificationChannelDescriptor(); + $channelDescriptors = [ + $channelDescriptorsElement, + ]; + $expectedResponse = new ListNotificationChannelDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setChannelDescriptors($channelDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListNotificationChannelDescriptorsRequest()) + ->setName($name); + $response = $gapicClient->listNotificationChannelDescriptors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getChannelDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/ListNotificationChannelDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListNotificationChannelDescriptorsRequest()) + ->setName($name); + try { + $gapicClient->listNotificationChannelDescriptors($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $notificationChannelsElement = new NotificationChannel(); + $notificationChannels = [ + $notificationChannelsElement, + ]; + $expectedResponse = new ListNotificationChannelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setNotificationChannels($notificationChannels); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ListNotificationChannelsRequest()) + ->setName($name); + $response = $gapicClient->listNotificationChannels($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotificationChannels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/ListNotificationChannels', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ListNotificationChannelsRequest()) + ->setName($name); + try { + $gapicClient->listNotificationChannels($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendNotificationChannelVerificationCodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new SendNotificationChannelVerificationCodeRequest()) + ->setName($formattedName); + $gapicClient->sendNotificationChannelVerificationCode($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendNotificationChannelVerificationCodeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $request = (new SendNotificationChannelVerificationCodeRequest()) + ->setName($formattedName); + try { + $gapicClient->sendNotificationChannelVerificationCode($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $notificationChannel = new NotificationChannel(); + $request = (new UpdateNotificationChannelRequest()) + ->setNotificationChannel($notificationChannel); + $response = $gapicClient->updateNotificationChannel($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/UpdateNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getNotificationChannel(); + $this->assertProtobufEquals($notificationChannel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $notificationChannel = new NotificationChannel(); + $request = (new UpdateNotificationChannelRequest()) + ->setNotificationChannel($notificationChannel); + try { + $gapicClient->updateNotificationChannel($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function verifyNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $code = 'code3059181'; + $request = (new VerifyNotificationChannelRequest()) + ->setName($formattedName) + ->setCode($code); + $response = $gapicClient->verifyNotificationChannel($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getCode(); + $this->assertProtobufEquals($code, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function verifyNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $code = 'code3059181'; + $request = (new VerifyNotificationChannelRequest()) + ->setName($formattedName) + ->setCode($code); + try { + $gapicClient->verifyNotificationChannel($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createNotificationChannelAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $notificationChannel = new NotificationChannel(); + $request = (new CreateNotificationChannelRequest()) + ->setName($name) + ->setNotificationChannel($notificationChannel); + $response = $gapicClient->createNotificationChannelAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/CreateNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getNotificationChannel(); + $this->assertProtobufEquals($notificationChannel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/QueryServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/QueryServiceClientTest.php new file mode 100644 index 000000000000..cd32140b2e9d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/QueryServiceClientTest.php @@ -0,0 +1,182 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return QueryServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new QueryServiceClient($options); + } + + /** @test */ + public function queryTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $timeSeriesDataElement = new TimeSeriesData(); + $timeSeriesData = [ + $timeSeriesDataElement, + ]; + $expectedResponse = new QueryTimeSeriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTimeSeriesData($timeSeriesData); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $query = 'query107944136'; + $request = (new QueryTimeSeriesRequest()) + ->setName($name) + ->setQuery($query); + $response = $gapicClient->queryTimeSeries($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTimeSeriesData()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.QueryService/QueryTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $query = 'query107944136'; + $request = (new QueryTimeSeriesRequest()) + ->setName($name) + ->setQuery($query); + try { + $gapicClient->queryTimeSeries($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryTimeSeriesAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $timeSeriesDataElement = new TimeSeriesData(); + $timeSeriesData = [ + $timeSeriesDataElement, + ]; + $expectedResponse = new QueryTimeSeriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTimeSeriesData($timeSeriesData); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $query = 'query107944136'; + $request = (new QueryTimeSeriesRequest()) + ->setName($name) + ->setQuery($query); + $response = $gapicClient->queryTimeSeriesAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTimeSeriesData()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.QueryService/QueryTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/ServiceMonitoringServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/ServiceMonitoringServiceClientTest.php new file mode 100644 index 000000000000..d679066683c4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/ServiceMonitoringServiceClientTest.php @@ -0,0 +1,790 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ServiceMonitoringServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ServiceMonitoringServiceClient($options); + } + + /** @test */ + public function createServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $service = new Service(); + $request = (new CreateServiceRequest()) + ->setParent($parent) + ->setService($service); + $response = $gapicClient->createService($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/CreateService', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $service = new Service(); + $request = (new CreateServiceRequest()) + ->setParent($parent) + ->setService($service); + try { + $gapicClient->createService($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $serviceLevelObjective = new ServiceLevelObjective(); + $request = (new CreateServiceLevelObjectiveRequest()) + ->setParent($formattedParent) + ->setServiceLevelObjective($serviceLevelObjective); + $response = $gapicClient->createServiceLevelObjective($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/CreateServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getServiceLevelObjective(); + $this->assertProtobufEquals($serviceLevelObjective, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $serviceLevelObjective = new ServiceLevelObjective(); + $request = (new CreateServiceLevelObjectiveRequest()) + ->setParent($formattedParent) + ->setServiceLevelObjective($serviceLevelObjective); + try { + $gapicClient->createServiceLevelObjective($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new DeleteServiceRequest()) + ->setName($formattedName); + $gapicClient->deleteService($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/DeleteService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new DeleteServiceRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteService($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $request = (new DeleteServiceLevelObjectiveRequest()) + ->setName($formattedName); + $gapicClient->deleteServiceLevelObjective($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/DeleteServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $request = (new DeleteServiceLevelObjectiveRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteServiceLevelObjective($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new GetServiceRequest()) + ->setName($formattedName); + $response = $gapicClient->getService($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new GetServiceRequest()) + ->setName($formattedName); + try { + $gapicClient->getService($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $request = (new GetServiceLevelObjectiveRequest()) + ->setName($formattedName); + $response = $gapicClient->getServiceLevelObjective($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/GetServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $request = (new GetServiceLevelObjectiveRequest()) + ->setName($formattedName); + try { + $gapicClient->getServiceLevelObjective($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceLevelObjectivesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $serviceLevelObjectivesElement = new ServiceLevelObjective(); + $serviceLevelObjectives = [ + $serviceLevelObjectivesElement, + ]; + $expectedResponse = new ListServiceLevelObjectivesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServiceLevelObjectives($serviceLevelObjectives); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new ListServiceLevelObjectivesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listServiceLevelObjectives($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServiceLevelObjectives()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/ListServiceLevelObjectives', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceLevelObjectivesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $request = (new ListServiceLevelObjectivesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listServiceLevelObjectives($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListServicesRequest()) + ->setParent($parent); + $response = $gapicClient->listServices($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListServicesRequest()) + ->setParent($parent); + try { + $gapicClient->listServices($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $service = new Service(); + $request = (new UpdateServiceRequest()) + ->setService($service); + $response = $gapicClient->updateService($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/UpdateService', $actualFuncCall); + $actualValue = $actualRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $service = new Service(); + $request = (new UpdateServiceRequest()) + ->setService($service); + try { + $gapicClient->updateService($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $serviceLevelObjective = new ServiceLevelObjective(); + $request = (new UpdateServiceLevelObjectiveRequest()) + ->setServiceLevelObjective($serviceLevelObjective); + $response = $gapicClient->updateServiceLevelObjective($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/UpdateServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getServiceLevelObjective(); + $this->assertProtobufEquals($serviceLevelObjective, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $serviceLevelObjective = new ServiceLevelObjective(); + $request = (new UpdateServiceLevelObjectiveRequest()) + ->setServiceLevelObjective($serviceLevelObjective); + try { + $gapicClient->updateServiceLevelObjective($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $service = new Service(); + $request = (new CreateServiceRequest()) + ->setParent($parent) + ->setService($service); + $response = $gapicClient->createServiceAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/CreateService', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/SnoozeServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/SnoozeServiceClientTest.php new file mode 100644 index 000000000000..f46286b29e35 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/SnoozeServiceClientTest.php @@ -0,0 +1,416 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SnoozeServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SnoozeServiceClient($options); + } + + /** @test */ + public function createSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $request = (new CreateSnoozeRequest()) + ->setParent($formattedParent) + ->setSnooze($snooze); + $response = $gapicClient->createSnooze($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/CreateSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSnooze(); + $this->assertProtobufEquals($snooze, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $request = (new CreateSnoozeRequest()) + ->setParent($formattedParent) + ->setSnooze($snooze); + try { + $gapicClient->createSnooze($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->snoozeName('[PROJECT]', '[SNOOZE]'); + $request = (new GetSnoozeRequest()) + ->setName($formattedName); + $response = $gapicClient->getSnooze($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/GetSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->snoozeName('[PROJECT]', '[SNOOZE]'); + $request = (new GetSnoozeRequest()) + ->setName($formattedName); + try { + $gapicClient->getSnooze($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnoozesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snoozesElement = new Snooze(); + $snoozes = [ + $snoozesElement, + ]; + $expectedResponse = new ListSnoozesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnoozes($snoozes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $request = (new ListSnoozesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listSnoozes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnoozes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/ListSnoozes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnoozesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $request = (new ListSnoozesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listSnoozes($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $updateMask = new FieldMask(); + $request = (new UpdateSnoozeRequest()) + ->setSnooze($snooze) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateSnooze($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/UpdateSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getSnooze(); + $this->assertProtobufEquals($snooze, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $updateMask = new FieldMask(); + $request = (new UpdateSnoozeRequest()) + ->setSnooze($snooze) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateSnooze($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnoozeAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $request = (new CreateSnoozeRequest()) + ->setParent($formattedParent) + ->setSnooze($snooze); + $response = $gapicClient->createSnoozeAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/CreateSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSnooze(); + $this->assertProtobufEquals($snooze, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/UptimeCheckServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/UptimeCheckServiceClientTest.php new file mode 100644 index 000000000000..8b1fc5ae6539 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/Client/UptimeCheckServiceClientTest.php @@ -0,0 +1,517 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return UptimeCheckServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new UptimeCheckServiceClient($options); + } + + /** @test */ + public function createUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $uptimeCheckConfig = new UptimeCheckConfig(); + $request = (new CreateUptimeCheckConfigRequest()) + ->setParent($parent) + ->setUptimeCheckConfig($uptimeCheckConfig); + $response = $gapicClient->createUptimeCheckConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getUptimeCheckConfig(); + $this->assertProtobufEquals($uptimeCheckConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $uptimeCheckConfig = new UptimeCheckConfig(); + $request = (new CreateUptimeCheckConfigRequest()) + ->setParent($parent) + ->setUptimeCheckConfig($uptimeCheckConfig); + try { + $gapicClient->createUptimeCheckConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $request = (new DeleteUptimeCheckConfigRequest()) + ->setName($formattedName); + $gapicClient->deleteUptimeCheckConfig($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $request = (new DeleteUptimeCheckConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteUptimeCheckConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $request = (new GetUptimeCheckConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getUptimeCheckConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $request = (new GetUptimeCheckConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getUptimeCheckConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $uptimeCheckConfigsElement = new UptimeCheckConfig(); + $uptimeCheckConfigs = [ + $uptimeCheckConfigsElement, + ]; + $expectedResponse = new ListUptimeCheckConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setUptimeCheckConfigs($uptimeCheckConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListUptimeCheckConfigsRequest()) + ->setParent($parent); + $response = $gapicClient->listUptimeCheckConfigs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUptimeCheckConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckConfigsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $request = (new ListUptimeCheckConfigsRequest()) + ->setParent($parent); + try { + $gapicClient->listUptimeCheckConfigs($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckIpsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $uptimeCheckIpsElement = new UptimeCheckIp(); + $uptimeCheckIps = [ + $uptimeCheckIpsElement, + ]; + $expectedResponse = new ListUptimeCheckIpsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUptimeCheckIps($uptimeCheckIps); + $transport->addResponse($expectedResponse); + $request = new ListUptimeCheckIpsRequest(); + $response = $gapicClient->listUptimeCheckIps($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUptimeCheckIps()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckIpsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + $request = new ListUptimeCheckIpsRequest(); + try { + $gapicClient->listUptimeCheckIps($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $uptimeCheckConfig = new UptimeCheckConfig(); + $request = (new UpdateUptimeCheckConfigRequest()) + ->setUptimeCheckConfig($uptimeCheckConfig); + $response = $gapicClient->updateUptimeCheckConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getUptimeCheckConfig(); + $this->assertProtobufEquals($uptimeCheckConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $uptimeCheckConfig = new UptimeCheckConfig(); + $request = (new UpdateUptimeCheckConfigRequest()) + ->setUptimeCheckConfig($uptimeCheckConfig); + try { + $gapicClient->updateUptimeCheckConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createUptimeCheckConfigAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $uptimeCheckConfig = new UptimeCheckConfig(); + $request = (new CreateUptimeCheckConfigRequest()) + ->setParent($parent) + ->setUptimeCheckConfig($uptimeCheckConfig); + $response = $gapicClient->createUptimeCheckConfigAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getUptimeCheckConfig(); + $this->assertProtobufEquals($uptimeCheckConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/GroupServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/GroupServiceClientTest.php new file mode 100644 index 000000000000..6ac70404aed4 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/GroupServiceClientTest.php @@ -0,0 +1,468 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return GroupServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GroupServiceClient($options); + } + + /** @test */ + public function createGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $group = new Group(); + $response = $gapicClient->createGroup($name, $group); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/CreateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $group = new Group(); + try { + $gapicClient->createGroup($name, $group); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $gapicClient->deleteGroup($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/DeleteGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + try { + $gapicClient->deleteGroup($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $response = $gapicClient->getGroup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + try { + $gapicClient->getGroup($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupMembersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $membersElement = new MonitoredResource(); + $members = [ + $membersElement, + ]; + $expectedResponse = new ListGroupMembersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setMembers($members); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + $response = $gapicClient->listGroupMembers($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMembers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/ListGroupMembers', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupMembersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[GROUP]'); + try { + $gapicClient->listGroupMembers($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $groupElement = new Group(); + $group = [ + $groupElement, + ]; + $expectedResponse = new ListGroupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGroup($group); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listGroups($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroup()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/ListGroups', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listGroups($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $parentName = 'parentName1015022848'; + $filter = 'filter-1274492040'; + $isCluster = false; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setParentName($parentName); + $expectedResponse->setFilter($filter); + $expectedResponse->setIsCluster($isCluster); + $transport->addResponse($expectedResponse); + // Mock request + $group = new Group(); + $response = $gapicClient->updateGroup($group); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.GroupService/UpdateGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateGroupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $group = new Group(); + try { + $gapicClient->updateGroup($group); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/MetricServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/MetricServiceClientTest.php new file mode 100644 index 000000000000..443a3f9faf17 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/MetricServiceClientTest.php @@ -0,0 +1,672 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return MetricServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new MetricServiceClient($options); + } + + /** @test */ + public function createMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $unit = 'unit3594628'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new MetricDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setUnit($unit); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $metricDescriptor = new MetricDescriptor(); + $response = $gapicClient->createMetricDescriptor($name, $metricDescriptor); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getMetricDescriptor(); + $this->assertProtobufEquals($metricDescriptor, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $metricDescriptor = new MetricDescriptor(); + try { + $gapicClient->createMetricDescriptor($name, $metricDescriptor); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $gapicClient->createServiceTimeSeries($formattedName, $timeSeries); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateServiceTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getTimeSeries(); + $this->assertProtobufEquals($timeSeries, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + try { + $gapicClient->createServiceTimeSeries($formattedName, $timeSeries); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + $gapicClient->createTimeSeries($formattedName, $timeSeries); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/CreateTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getTimeSeries(); + $this->assertProtobufEquals($timeSeries, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $timeSeries = []; + try { + $gapicClient->createTimeSeries($formattedName, $timeSeries); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $gapicClient->deleteMetricDescriptor($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/DeleteMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + try { + $gapicClient->deleteMetricDescriptor($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetricDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $unit = 'unit3594628'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new MetricDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setUnit($unit); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + $response = $gapicClient->getMetricDescriptor($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/GetMetricDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMetricDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); + try { + $gapicClient->getMetricDescriptor($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMonitoredResourceDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new MonitoredResourceDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); + $response = $gapicClient->getMonitoredResourceDescriptor($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/GetMonitoredResourceDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMonitoredResourceDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); + try { + $gapicClient->getMonitoredResourceDescriptor($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetricDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $metricDescriptorsElement = new MetricDescriptor(); + $metricDescriptors = [ + $metricDescriptorsElement, + ]; + $expectedResponse = new ListMetricDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMetricDescriptors($metricDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listMetricDescriptors($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMetricDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListMetricDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMetricDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listMetricDescriptors($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMonitoredResourceDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $resourceDescriptorsElement = new MonitoredResourceDescriptor(); + $resourceDescriptors = [ + $resourceDescriptorsElement, + ]; + $expectedResponse = new ListMonitoredResourceDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setResourceDescriptors($resourceDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listMonitoredResourceDescriptors($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getResourceDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListMonitoredResourceDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMonitoredResourceDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listMonitoredResourceDescriptors($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $unit = 'unit3594628'; + $timeSeriesElement = new TimeSeries(); + $timeSeries = [ + $timeSeriesElement, + ]; + $expectedResponse = new ListTimeSeriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUnit($unit); + $expectedResponse->setTimeSeries($timeSeries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]'); + $filter = 'filter-1274492040'; + $interval = new TimeInterval(); + $view = TimeSeriesView::FULL; + $response = $gapicClient->listTimeSeries($formattedName, $filter, $interval, $view); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTimeSeries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.MetricService/ListTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getFilter(); + $this->assertProtobufEquals($filter, $actualValue); + $actualValue = $actualRequestObject->getInterval(); + $this->assertProtobufEquals($interval, $actualValue); + $actualValue = $actualRequestObject->getView(); + $this->assertProtobufEquals($view, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->workspaceName('[PROJECT]'); + $filter = 'filter-1274492040'; + $interval = new TimeInterval(); + $view = TimeSeriesView::FULL; + try { + $gapicClient->listTimeSeries($formattedName, $filter, $interval, $view); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/NotificationChannelServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/NotificationChannelServiceClientTest.php new file mode 100644 index 000000000000..9b115e176970 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/NotificationChannelServiceClientTest.php @@ -0,0 +1,716 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return NotificationChannelServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new NotificationChannelServiceClient($options); + } + + /** @test */ + public function createNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $notificationChannel = new NotificationChannel(); + $response = $gapicClient->createNotificationChannel($name, $notificationChannel); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/CreateNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getNotificationChannel(); + $this->assertProtobufEquals($notificationChannel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $notificationChannel = new NotificationChannel(); + try { + $gapicClient->createNotificationChannel($name, $notificationChannel); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $gapicClient->deleteNotificationChannel($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/DeleteNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + try { + $gapicClient->deleteNotificationChannel($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $response = $gapicClient->getNotificationChannel($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + try { + $gapicClient->getNotificationChannel($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelDescriptorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannelDescriptor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelDescriptorName('[PROJECT]', '[CHANNEL_DESCRIPTOR]'); + $response = $gapicClient->getNotificationChannelDescriptor($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannelDescriptor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelDescriptorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelDescriptorName('[PROJECT]', '[CHANNEL_DESCRIPTOR]'); + try { + $gapicClient->getNotificationChannelDescriptor($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelVerificationCodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $code = 'code3059181'; + $expectedResponse = new GetNotificationChannelVerificationCodeResponse(); + $expectedResponse->setCode($code); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $response = $gapicClient->getNotificationChannelVerificationCode($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/GetNotificationChannelVerificationCode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNotificationChannelVerificationCodeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + try { + $gapicClient->getNotificationChannelVerificationCode($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelDescriptorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $channelDescriptorsElement = new NotificationChannelDescriptor(); + $channelDescriptors = [ + $channelDescriptorsElement, + ]; + $expectedResponse = new ListNotificationChannelDescriptorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setChannelDescriptors($channelDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listNotificationChannelDescriptors($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getChannelDescriptors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/ListNotificationChannelDescriptors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelDescriptorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listNotificationChannelDescriptors($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $notificationChannelsElement = new NotificationChannel(); + $notificationChannels = [ + $notificationChannelsElement, + ]; + $expectedResponse = new ListNotificationChannelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setNotificationChannels($notificationChannels); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->listNotificationChannels($name); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNotificationChannels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/ListNotificationChannels', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNotificationChannelsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->listNotificationChannels($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendNotificationChannelVerificationCodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $gapicClient->sendNotificationChannelVerificationCode($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function sendNotificationChannelVerificationCodeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + try { + $gapicClient->sendNotificationChannelVerificationCode($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $notificationChannel = new NotificationChannel(); + $response = $gapicClient->updateNotificationChannel($notificationChannel); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/UpdateNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getNotificationChannel(); + $this->assertProtobufEquals($notificationChannel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $notificationChannel = new NotificationChannel(); + try { + $gapicClient->updateNotificationChannel($notificationChannel); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function verifyNotificationChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $type = 'type3575610'; + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new NotificationChannel(); + $expectedResponse->setType($type); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $code = 'code3059181'; + $response = $gapicClient->verifyNotificationChannel($formattedName, $code); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getCode(); + $this->assertProtobufEquals($code, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function verifyNotificationChannelExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->notificationChannelName('[PROJECT]', '[NOTIFICATION_CHANNEL]'); + $code = 'code3059181'; + try { + $gapicClient->verifyNotificationChannel($formattedName, $code); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/QueryServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/QueryServiceClientTest.php new file mode 100644 index 000000000000..c64caa89013d --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/QueryServiceClientTest.php @@ -0,0 +1,134 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return QueryServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new QueryServiceClient($options); + } + + /** @test */ + public function queryTimeSeriesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $timeSeriesDataElement = new TimeSeriesData(); + $timeSeriesData = [ + $timeSeriesDataElement, + ]; + $expectedResponse = new QueryTimeSeriesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTimeSeriesData($timeSeriesData); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $query = 'query107944136'; + $response = $gapicClient->queryTimeSeries($name, $query); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTimeSeriesData()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.QueryService/QueryTimeSeries', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function queryTimeSeriesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $query = 'query107944136'; + try { + $gapicClient->queryTimeSeries($name, $query); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/ServiceMonitoringServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/ServiceMonitoringServiceClientTest.php new file mode 100644 index 000000000000..7651f7245bce --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/ServiceMonitoringServiceClientTest.php @@ -0,0 +1,701 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ServiceMonitoringServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ServiceMonitoringServiceClient($options); + } + + /** @test */ + public function createServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $service = new Service(); + $response = $gapicClient->createService($parent, $service); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/CreateService', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $service = new Service(); + try { + $gapicClient->createService($parent, $service); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $serviceLevelObjective = new ServiceLevelObjective(); + $response = $gapicClient->createServiceLevelObjective($formattedParent, $serviceLevelObjective); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/CreateServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getServiceLevelObjective(); + $this->assertProtobufEquals($serviceLevelObjective, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $serviceLevelObjective = new ServiceLevelObjective(); + try { + $gapicClient->createServiceLevelObjective($formattedParent, $serviceLevelObjective); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $gapicClient->deleteService($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/DeleteService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + try { + $gapicClient->deleteService($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $gapicClient->deleteServiceLevelObjective($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/DeleteServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + try { + $gapicClient->deleteServiceLevelObjective($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $response = $gapicClient->getService($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/GetService', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + try { + $gapicClient->getService($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + $response = $gapicClient->getServiceLevelObjective($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/GetServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->serviceLevelObjectiveName('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]'); + try { + $gapicClient->getServiceLevelObjective($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceLevelObjectivesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $serviceLevelObjectivesElement = new ServiceLevelObjective(); + $serviceLevelObjectives = [ + $serviceLevelObjectivesElement, + ]; + $expectedResponse = new ListServiceLevelObjectivesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServiceLevelObjectives($serviceLevelObjectives); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + $response = $gapicClient->listServiceLevelObjectives($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServiceLevelObjectives()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/ListServiceLevelObjectives', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServiceLevelObjectivesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->serviceName('[PROJECT]', '[SERVICE]'); + try { + $gapicClient->listServiceLevelObjectives($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $servicesElement = new Service(); + $services = [ + $servicesElement, + ]; + $expectedResponse = new ListServicesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setServices($services); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $gapicClient->listServices($parent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getServices()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/ListServices', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listServicesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + try { + $gapicClient->listServices($parent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Service(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $service = new Service(); + $response = $gapicClient->updateService($service); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/UpdateService', $actualFuncCall); + $actualValue = $actualRequestObject->getService(); + $this->assertProtobufEquals($service, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $service = new Service(); + try { + $gapicClient->updateService($service); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceLevelObjectiveTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 317825.0; + $expectedResponse = new ServiceLevelObjective(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $transport->addResponse($expectedResponse); + // Mock request + $serviceLevelObjective = new ServiceLevelObjective(); + $response = $gapicClient->updateServiceLevelObjective($serviceLevelObjective); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.ServiceMonitoringService/UpdateServiceLevelObjective', $actualFuncCall); + $actualValue = $actualRequestObject->getServiceLevelObjective(); + $this->assertProtobufEquals($serviceLevelObjective, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateServiceLevelObjectiveExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $serviceLevelObjective = new ServiceLevelObjective(); + try { + $gapicClient->updateServiceLevelObjective($serviceLevelObjective); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/SnoozeServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/SnoozeServiceClientTest.php new file mode 100644 index 000000000000..e446ff828d47 --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/SnoozeServiceClientTest.php @@ -0,0 +1,351 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SnoozeServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SnoozeServiceClient($options); + } + + /** @test */ + public function createSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $response = $gapicClient->createSnooze($formattedParent, $snooze); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/CreateSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSnooze(); + $this->assertProtobufEquals($snooze, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + try { + $gapicClient->createSnooze($formattedParent, $snooze); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->snoozeName('[PROJECT]', '[SNOOZE]'); + $response = $gapicClient->getSnooze($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/GetSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->snoozeName('[PROJECT]', '[SNOOZE]'); + try { + $gapicClient->getSnooze($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnoozesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $snoozesElement = new Snooze(); + $snoozes = [ + $snoozesElement, + ]; + $expectedResponse = new ListSnoozesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSnoozes($snoozes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + $response = $gapicClient->listSnoozes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSnoozes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/ListSnoozes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSnoozesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->workspaceName('[PROJECT]'); + try { + $gapicClient->listSnoozes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnoozeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Snooze(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $updateMask = new FieldMask(); + $response = $gapicClient->updateSnooze($snooze, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.SnoozeService/UpdateSnooze', $actualFuncCall); + $actualValue = $actualRequestObject->getSnooze(); + $this->assertProtobufEquals($snooze, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSnoozeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $snooze = new Snooze(); + $snoozeCriteria = new Criteria(); + $snooze->setCriteria($snoozeCriteria); + $snoozeInterval = new TimeInterval(); + $snooze->setInterval($snoozeInterval); + $snoozeDisplayName = 'snoozeDisplayName-1956223833'; + $snooze->setDisplayName($snoozeDisplayName); + $updateMask = new FieldMask(); + try { + $gapicClient->updateSnooze($snooze, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Monitoring/v3/tests/Unit/V3/UptimeCheckServiceClientTest.php b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/UptimeCheckServiceClientTest.php new file mode 100644 index 000000000000..40d14acd439f --- /dev/null +++ b/owl-bot-staging/Monitoring/v3/tests/Unit/V3/UptimeCheckServiceClientTest.php @@ -0,0 +1,450 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return UptimeCheckServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new UptimeCheckServiceClient($options); + } + + /** @test */ + public function createUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $uptimeCheckConfig = new UptimeCheckConfig(); + $response = $gapicClient->createUptimeCheckConfig($parent, $uptimeCheckConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getUptimeCheckConfig(); + $this->assertProtobufEquals($uptimeCheckConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + $uptimeCheckConfig = new UptimeCheckConfig(); + try { + $gapicClient->createUptimeCheckConfig($parent, $uptimeCheckConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $gapicClient->deleteUptimeCheckConfig($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + try { + $gapicClient->deleteUptimeCheckConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + $response = $gapicClient->getUptimeCheckConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->uptimeCheckConfigName('[PROJECT]', '[UPTIME_CHECK_CONFIG]'); + try { + $gapicClient->getUptimeCheckConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $totalSize = 705419236; + $uptimeCheckConfigsElement = new UptimeCheckConfig(); + $uptimeCheckConfigs = [ + $uptimeCheckConfigsElement, + ]; + $expectedResponse = new ListUptimeCheckConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTotalSize($totalSize); + $expectedResponse->setUptimeCheckConfigs($uptimeCheckConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $response = $gapicClient->listUptimeCheckConfigs($parent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUptimeCheckConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckConfigsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $parent = 'parent-995424086'; + try { + $gapicClient->listUptimeCheckConfigs($parent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckIpsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $uptimeCheckIpsElement = new UptimeCheckIp(); + $uptimeCheckIps = [ + $uptimeCheckIpsElement, + ]; + $expectedResponse = new ListUptimeCheckIpsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUptimeCheckIps($uptimeCheckIps); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listUptimeCheckIps(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUptimeCheckIps()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUptimeCheckIpsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listUptimeCheckIps(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateUptimeCheckConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $isInternal = true; + $expectedResponse = new UptimeCheckConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setIsInternal($isInternal); + $transport->addResponse($expectedResponse); + // Mock request + $uptimeCheckConfig = new UptimeCheckConfig(); + $response = $gapicClient->updateUptimeCheckConfig($uptimeCheckConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getUptimeCheckConfig(); + $this->assertProtobufEquals($uptimeCheckConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateUptimeCheckConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $uptimeCheckConfig = new UptimeCheckConfig(); + try { + $gapicClient->updateUptimeCheckConfig($uptimeCheckConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +}