1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\Logging\Resource; 19 20use Google\Service\Logging\CmekSettings; 21use Google\Service\Logging\Settings; 22 23/** 24 * The "v2" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $loggingService = new Google\Service\Logging(...); 28 * $v2 = $loggingService->v2; 29 * </code> 30 */ 31class V2 extends \Google\Service\Resource 32{ 33 /** 34 * Gets the Logging CMEK settings for the given resource.Note: CMEK for the Log 35 * Router can be configured for Google Cloud projects, folders, organizations 36 * and billing accounts. Once configured for an organization, it applies to all 37 * projects and folders in the Google Cloud organization.See Enabling CMEK for 38 * Log Router (https://cloud.google.com/logging/docs/routing/managed-encryption) 39 * for more information. (v2.getCmekSettings) 40 * 41 * @param string $name Required. The resource for which to retrieve CMEK 42 * settings. "projects/[PROJECT_ID]/cmekSettings" 43 * "organizations/[ORGANIZATION_ID]/cmekSettings" 44 * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" 45 * "folders/[FOLDER_ID]/cmekSettings" For 46 * example:"organizations/12345/cmekSettings"Note: CMEK for the Log Router can 47 * be configured for Google Cloud projects, folders, organizations and billing 48 * accounts. Once configured for an organization, it applies to all projects and 49 * folders in the Google Cloud organization. 50 * @param array $optParams Optional parameters. 51 * @return CmekSettings 52 */ 53 public function getCmekSettings($name, $optParams = []) 54 { 55 $params = ['name' => $name]; 56 $params = array_merge($params, $optParams); 57 return $this->call('getCmekSettings', [$params], CmekSettings::class); 58 } 59 /** 60 * Gets the Log Router settings for the given resource.Note: Settings for the 61 * Log Router can be get for Google Cloud projects, folders, organizations and 62 * billing accounts. Currently it can only be configured for organizations. Once 63 * configured for an organization, it applies to all projects and folders in the 64 * Google Cloud organization.See Enabling CMEK for Log Router 65 * (https://cloud.google.com/logging/docs/routing/managed-encryption) for more 66 * information. (v2.getSettings) 67 * 68 * @param string $name Required. The resource for which to retrieve settings. 69 * "projects/[PROJECT_ID]/settings" "organizations/[ORGANIZATION_ID]/settings" 70 * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" 71 * "folders/[FOLDER_ID]/settings" For 72 * example:"organizations/12345/settings"Note: Settings for the Log Router can 73 * be get for Google Cloud projects, folders, organizations and billing 74 * accounts. Currently it can only be configured for organizations. Once 75 * configured for an organization, it applies to all projects and folders in the 76 * Google Cloud organization. 77 * @param array $optParams Optional parameters. 78 * @return Settings 79 */ 80 public function getSettings($name, $optParams = []) 81 { 82 $params = ['name' => $name]; 83 $params = array_merge($params, $optParams); 84 return $this->call('getSettings', [$params], Settings::class); 85 } 86 /** 87 * Updates the Log Router CMEK settings for the given resource.Note: CMEK for 88 * the Log Router can currently only be configured for Google Cloud 89 * organizations. Once configured, it applies to all projects and folders in the 90 * Google Cloud organization.UpdateCmekSettings will fail if 1) kms_key_name is 91 * invalid, or 2) the associated service account does not have the required 92 * roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) 93 * access to the key is disabled.See Enabling CMEK for Log Router 94 * (https://cloud.google.com/logging/docs/routing/managed-encryption) for more 95 * information. (v2.updateCmekSettings) 96 * 97 * @param string $name Required. The resource name for the CMEK settings to 98 * update. "projects/[PROJECT_ID]/cmekSettings" 99 * "organizations/[ORGANIZATION_ID]/cmekSettings" 100 * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" 101 * "folders/[FOLDER_ID]/cmekSettings" For 102 * example:"organizations/12345/cmekSettings"Note: CMEK for the Log Router can 103 * currently only be configured for Google Cloud organizations. Once configured, 104 * it applies to all projects and folders in the Google Cloud organization. 105 * @param CmekSettings $postBody 106 * @param array $optParams Optional parameters. 107 * 108 * @opt_param string updateMask Optional. Field mask identifying which fields 109 * from cmek_settings should be updated. A field will be overwritten if and only 110 * if it is in the update mask. Output only fields cannot be updated.See 111 * FieldMask for more information.For example: "updateMask=kmsKeyName" 112 * @return CmekSettings 113 */ 114 public function updateCmekSettings($name, CmekSettings $postBody, $optParams = []) 115 { 116 $params = ['name' => $name, 'postBody' => $postBody]; 117 $params = array_merge($params, $optParams); 118 return $this->call('updateCmekSettings', [$params], CmekSettings::class); 119 } 120 /** 121 * Updates the Log Router settings for the given resource.Note: Settings for the 122 * Log Router can currently only be configured for Google Cloud organizations. 123 * Once configured, it applies to all projects and folders in the Google Cloud 124 * organization.UpdateSettings will fail if 1) kms_key_name is invalid, or 2) 125 * the associated service account does not have the required 126 * roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) 127 * access to the key is disabled. 4) location_id is not supported by Logging. 5) 128 * location_id violate OrgPolicy.See Enabling CMEK for Log Router 129 * (https://cloud.google.com/logging/docs/routing/managed-encryption) for more 130 * information. (v2.updateSettings) 131 * 132 * @param string $name Required. The resource name for the settings to update. 133 * "organizations/[ORGANIZATION_ID]/settings" For 134 * example:"organizations/12345/settings"Note: Settings for the Log Router can 135 * currently only be configured for Google Cloud organizations. Once configured, 136 * it applies to all projects and folders in the Google Cloud organization. 137 * @param Settings $postBody 138 * @param array $optParams Optional parameters. 139 * 140 * @opt_param string updateMask Optional. Field mask identifying which fields 141 * from settings should be updated. A field will be overwritten if and only if 142 * it is in the update mask. Output only fields cannot be updated.See FieldMask 143 * for more information.For example: "updateMask=kmsKeyName" 144 * @return Settings 145 */ 146 public function updateSettings($name, Settings $postBody, $optParams = []) 147 { 148 $params = ['name' => $name, 'postBody' => $postBody]; 149 $params = array_merge($params, $optParams); 150 return $this->call('updateSettings', [$params], Settings::class); 151 } 152} 153 154// Adding a class alias for backwards compatibility with the previous class name. 155class_alias(V2::class, 'Google_Service_Logging_Resource_V2'); 156