1# -*- coding: utf-8 -*- # 2# Copyright 2015 Google LLC. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15"""Resource definitions for cloud platform apis.""" 16 17import enum 18 19 20BASE_URL = 'https://run.googleapis.com/v1/' 21DOCS_URL = 'https://cloud.google.com/run/' 22 23 24class Collections(enum.Enum): 25 """Collections for all supported apis.""" 26 27 API_V1_NAMESPACES = ( 28 'api.v1.namespaces', 29 '{+name}', 30 { 31 '': 32 'namespaces/{namespacesId}', 33 }, 34 ['name'], 35 True 36 ) 37 API_V1_NAMESPACES_SECRETS = ( 38 'api.v1.namespaces.secrets', 39 '{+name}', 40 { 41 '': 42 'namespaces/{namespacesId}/secrets/{secretsId}', 43 }, 44 ['name'], 45 True 46 ) 47 NAMESPACES_CONFIGURATIONS = ( 48 'namespaces.configurations', 49 '{+name}', 50 { 51 '': 52 'namespaces/{namespacesId}/configurations/{configurationsId}', 53 }, 54 ['name'], 55 True 56 ) 57 NAMESPACES_DOMAINMAPPINGS = ( 58 'namespaces.domainmappings', 59 '{+name}', 60 { 61 '': 62 'namespaces/{namespacesId}/domainmappings/{domainmappingsId}', 63 }, 64 ['name'], 65 True 66 ) 67 NAMESPACES_REVISIONS = ( 68 'namespaces.revisions', 69 '{+name}', 70 { 71 '': 72 'namespaces/{namespacesId}/revisions/{revisionsId}', 73 }, 74 ['name'], 75 True 76 ) 77 NAMESPACES_ROUTES = ( 78 'namespaces.routes', 79 '{+name}', 80 { 81 '': 82 'namespaces/{namespacesId}/routes/{routesId}', 83 }, 84 ['name'], 85 True 86 ) 87 NAMESPACES_SERVICES = ( 88 'namespaces.services', 89 '{+name}', 90 { 91 '': 92 'namespaces/{namespacesId}/services/{servicesId}', 93 }, 94 ['name'], 95 True 96 ) 97 PROJECTS = ( 98 'projects', 99 'projects/{projectsId}', 100 {}, 101 ['projectsId'], 102 True 103 ) 104 PROJECTS_LOCATIONS = ( 105 'projects.locations', 106 'projects/{projectsId}/locations/{locationsId}', 107 {}, 108 ['projectsId', 'locationsId'], 109 True 110 ) 111 PROJECTS_LOCATIONS_CONFIGURATIONS = ( 112 'projects.locations.configurations', 113 '{+name}', 114 { 115 '': 116 'projects/{projectsId}/locations/{locationsId}/configurations/' 117 '{configurationsId}', 118 }, 119 ['name'], 120 True 121 ) 122 PROJECTS_LOCATIONS_DOMAINMAPPINGS = ( 123 'projects.locations.domainmappings', 124 '{+name}', 125 { 126 '': 127 'projects/{projectsId}/locations/{locationsId}/domainmappings/' 128 '{domainmappingsId}', 129 }, 130 ['name'], 131 True 132 ) 133 PROJECTS_LOCATIONS_NAMESPACES = ( 134 'projects.locations.namespaces', 135 '{+name}', 136 { 137 '': 138 'projects/{projectsId}/locations/{locationsId}/namespaces/' 139 '{namespacesId}', 140 }, 141 ['name'], 142 True 143 ) 144 PROJECTS_LOCATIONS_REVISIONS = ( 145 'projects.locations.revisions', 146 '{+name}', 147 { 148 '': 149 'projects/{projectsId}/locations/{locationsId}/revisions/' 150 '{revisionsId}', 151 }, 152 ['name'], 153 True 154 ) 155 PROJECTS_LOCATIONS_ROUTES = ( 156 'projects.locations.routes', 157 '{+name}', 158 { 159 '': 160 'projects/{projectsId}/locations/{locationsId}/routes/' 161 '{routesId}', 162 }, 163 ['name'], 164 True 165 ) 166 PROJECTS_LOCATIONS_SECRETS = ( 167 'projects.locations.secrets', 168 '{+name}', 169 { 170 '': 171 'projects/{projectsId}/locations/{locationsId}/secrets/' 172 '{secretsId}', 173 }, 174 ['name'], 175 True 176 ) 177 PROJECTS_LOCATIONS_SERVICES = ( 178 'projects.locations.services', 179 '{+name}', 180 { 181 '': 182 'projects/{projectsId}/locations/{locationsId}/services/' 183 '{servicesId}', 184 }, 185 ['name'], 186 True 187 ) 188 189 def __init__(self, collection_name, path, flat_paths, params, 190 enable_uri_parsing): 191 self.collection_name = collection_name 192 self.path = path 193 self.flat_paths = flat_paths 194 self.params = params 195 self.enable_uri_parsing = enable_uri_parsing 196