iam-gen.go 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365
  1. // Package iam provides access to the Google Identity and Access Management API.
  2. //
  3. // See https://cloud.google.com/iam/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/iam/v1"
  8. // ...
  9. // iamService, err := iam.New(oauthHttpClient)
  10. package iam // import "google.golang.org/api/iam/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "iam:v1"
  41. const apiName = "iam"
  42. const apiVersion = "v1"
  43. const basePath = "https://iam.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. )
  49. func New(client *http.Client) (*Service, error) {
  50. if client == nil {
  51. return nil, errors.New("client is nil")
  52. }
  53. s := &Service{client: client, BasePath: basePath}
  54. s.Projects = NewProjectsService(s)
  55. return s, nil
  56. }
  57. type Service struct {
  58. client *http.Client
  59. BasePath string // API endpoint base URL
  60. UserAgent string // optional additional User-Agent fragment
  61. Projects *ProjectsService
  62. }
  63. func (s *Service) userAgent() string {
  64. if s.UserAgent == "" {
  65. return googleapi.UserAgent
  66. }
  67. return googleapi.UserAgent + " " + s.UserAgent
  68. }
  69. func NewProjectsService(s *Service) *ProjectsService {
  70. rs := &ProjectsService{s: s}
  71. rs.ServiceAccounts = NewProjectsServiceAccountsService(s)
  72. return rs
  73. }
  74. type ProjectsService struct {
  75. s *Service
  76. ServiceAccounts *ProjectsServiceAccountsService
  77. }
  78. func NewProjectsServiceAccountsService(s *Service) *ProjectsServiceAccountsService {
  79. rs := &ProjectsServiceAccountsService{s: s}
  80. rs.Keys = NewProjectsServiceAccountsKeysService(s)
  81. return rs
  82. }
  83. type ProjectsServiceAccountsService struct {
  84. s *Service
  85. Keys *ProjectsServiceAccountsKeysService
  86. }
  87. func NewProjectsServiceAccountsKeysService(s *Service) *ProjectsServiceAccountsKeysService {
  88. rs := &ProjectsServiceAccountsKeysService{s: s}
  89. return rs
  90. }
  91. type ProjectsServiceAccountsKeysService struct {
  92. s *Service
  93. }
  94. // Binding: Associates `members` with a `role`.
  95. type Binding struct {
  96. // Members: Specifies the identities requesting access for a Cloud
  97. // Platform resource. `members` can have the following values: *
  98. // `allUsers`: A special identifier that represents anyone who is on the
  99. // internet; with or without a Google account. *
  100. // `allAuthenticatedUsers`: A special identifier that represents anyone
  101. // who is authenticated with a Google account or a service account. *
  102. // `user:{emailid}`: An email address that represents a specific Google
  103. // account. For example, `alice@gmail.com` or `joe@example.com`. *
  104. // `serviceAccount:{emailid}`: An email address that represents a
  105. // service account. For example,
  106. // `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An
  107. // email address that represents a Google group. For example,
  108. // `admins@example.com`. * `domain:{domain}`: A Google Apps domain name
  109. // that represents all the users of that domain. For example,
  110. // `google.com` or `example.com`.
  111. Members []string `json:"members,omitempty"`
  112. // Role: Role that is assigned to `members`. For example,
  113. // `roles/viewer`, `roles/editor`, or `roles/owner`. Required
  114. Role string `json:"role,omitempty"`
  115. // ForceSendFields is a list of field names (e.g. "Members") to
  116. // unconditionally include in API requests. By default, fields with
  117. // empty values are omitted from API requests. However, any non-pointer,
  118. // non-interface field appearing in ForceSendFields will be sent to the
  119. // server regardless of whether the field is empty or not. This may be
  120. // used to include empty fields in Patch requests.
  121. ForceSendFields []string `json:"-"`
  122. }
  123. func (s *Binding) MarshalJSON() ([]byte, error) {
  124. type noMethod Binding
  125. raw := noMethod(*s)
  126. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  127. }
  128. // CloudAuditOptions: Write a Cloud Audit log
  129. type CloudAuditOptions struct {
  130. }
  131. // Condition: A condition to be met.
  132. type Condition struct {
  133. // Iam: Trusted attributes supplied by the IAM system.
  134. //
  135. // Possible values:
  136. // "NO_ATTR"
  137. // "AUTHORITY"
  138. // "ATTRIBUTION"
  139. Iam string `json:"iam,omitempty"`
  140. // Op: An operator to apply the subject with.
  141. //
  142. // Possible values:
  143. // "NO_OP"
  144. // "EQUALS"
  145. // "NOT_EQUALS"
  146. // "IN"
  147. // "NOT_IN"
  148. // "DISCHARGED"
  149. Op string `json:"op,omitempty"`
  150. // Svc: Trusted attributes discharged by the service.
  151. Svc string `json:"svc,omitempty"`
  152. // Sys: Trusted attributes supplied by any service that owns resources
  153. // and uses the IAM system for access control.
  154. //
  155. // Possible values:
  156. // "NO_ATTR"
  157. // "REGION"
  158. // "SERVICE"
  159. // "NAME"
  160. // "IP"
  161. Sys string `json:"sys,omitempty"`
  162. // Value: The object of the condition. Exactly one of these must be set.
  163. Value string `json:"value,omitempty"`
  164. // Values: The objects of the condition. This is mutually exclusive with
  165. // 'value'.
  166. Values []string `json:"values,omitempty"`
  167. // ForceSendFields is a list of field names (e.g. "Iam") to
  168. // unconditionally include in API requests. By default, fields with
  169. // empty values are omitted from API requests. However, any non-pointer,
  170. // non-interface field appearing in ForceSendFields will be sent to the
  171. // server regardless of whether the field is empty or not. This may be
  172. // used to include empty fields in Patch requests.
  173. ForceSendFields []string `json:"-"`
  174. }
  175. func (s *Condition) MarshalJSON() ([]byte, error) {
  176. type noMethod Condition
  177. raw := noMethod(*s)
  178. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  179. }
  180. // CounterOptions: Options for counters
  181. type CounterOptions struct {
  182. // Field: The field value to attribute.
  183. Field string `json:"field,omitempty"`
  184. // Metric: The metric to update.
  185. Metric string `json:"metric,omitempty"`
  186. // ForceSendFields is a list of field names (e.g. "Field") to
  187. // unconditionally include in API requests. By default, fields with
  188. // empty values are omitted from API requests. However, any non-pointer,
  189. // non-interface field appearing in ForceSendFields will be sent to the
  190. // server regardless of whether the field is empty or not. This may be
  191. // used to include empty fields in Patch requests.
  192. ForceSendFields []string `json:"-"`
  193. }
  194. func (s *CounterOptions) MarshalJSON() ([]byte, error) {
  195. type noMethod CounterOptions
  196. raw := noMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  198. }
  199. // CreateServiceAccountKeyRequest: The service account key create
  200. // request.
  201. type CreateServiceAccountKeyRequest struct {
  202. // PrivateKeyType: The type of the key requested. GOOGLE_CREDENTIALS is
  203. // the default key type.
  204. //
  205. // Possible values:
  206. // "TYPE_UNSPECIFIED"
  207. // "TYPE_PKCS12_FILE"
  208. // "TYPE_GOOGLE_CREDENTIALS_FILE"
  209. PrivateKeyType string `json:"privateKeyType,omitempty"`
  210. // ForceSendFields is a list of field names (e.g. "PrivateKeyType") to
  211. // unconditionally include in API requests. By default, fields with
  212. // empty values are omitted from API requests. However, any non-pointer,
  213. // non-interface field appearing in ForceSendFields will be sent to the
  214. // server regardless of whether the field is empty or not. This may be
  215. // used to include empty fields in Patch requests.
  216. ForceSendFields []string `json:"-"`
  217. }
  218. func (s *CreateServiceAccountKeyRequest) MarshalJSON() ([]byte, error) {
  219. type noMethod CreateServiceAccountKeyRequest
  220. raw := noMethod(*s)
  221. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  222. }
  223. // CreateServiceAccountRequest: The service account create request.
  224. type CreateServiceAccountRequest struct {
  225. // AccountId: Required. The account id that is used to generate the
  226. // service account email address and a stable unique id. It is unique
  227. // within a project, must be 1-63 characters long, and match the regular
  228. // expression [a-z]([-a-z0-9]*[a-z0-9]) to comply with RFC1035.
  229. AccountId string `json:"accountId,omitempty"`
  230. // ServiceAccount: The ServiceAccount resource to create. Currently,
  231. // only the following values are user assignable: display_name .
  232. ServiceAccount *ServiceAccount `json:"serviceAccount,omitempty"`
  233. // ForceSendFields is a list of field names (e.g. "AccountId") to
  234. // unconditionally include in API requests. By default, fields with
  235. // empty values are omitted from API requests. However, any non-pointer,
  236. // non-interface field appearing in ForceSendFields will be sent to the
  237. // server regardless of whether the field is empty or not. This may be
  238. // used to include empty fields in Patch requests.
  239. ForceSendFields []string `json:"-"`
  240. }
  241. func (s *CreateServiceAccountRequest) MarshalJSON() ([]byte, error) {
  242. type noMethod CreateServiceAccountRequest
  243. raw := noMethod(*s)
  244. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  245. }
  246. // DataAccessOptions: Write a Data Access (Gin) log
  247. type DataAccessOptions struct {
  248. }
  249. // Empty: A generic empty message that you can re-use to avoid defining
  250. // duplicated empty messages in your APIs. A typical example is to use
  251. // it as the request or the response type of an API method. For
  252. // instance: service Foo { rpc Bar(google.protobuf.Empty) returns
  253. // (google.protobuf.Empty); } The JSON representation for `Empty` is
  254. // empty JSON object `{}`.
  255. type Empty struct {
  256. // ServerResponse contains the HTTP response code and headers from the
  257. // server.
  258. googleapi.ServerResponse `json:"-"`
  259. }
  260. // ListServiceAccountKeysResponse: The service account keys list
  261. // response.
  262. type ListServiceAccountKeysResponse struct {
  263. // Keys: The public keys for the service account.
  264. Keys []*ServiceAccountKey `json:"keys,omitempty"`
  265. // ServerResponse contains the HTTP response code and headers from the
  266. // server.
  267. googleapi.ServerResponse `json:"-"`
  268. // ForceSendFields is a list of field names (e.g. "Keys") to
  269. // unconditionally include in API requests. By default, fields with
  270. // empty values are omitted from API requests. However, any non-pointer,
  271. // non-interface field appearing in ForceSendFields will be sent to the
  272. // server regardless of whether the field is empty or not. This may be
  273. // used to include empty fields in Patch requests.
  274. ForceSendFields []string `json:"-"`
  275. }
  276. func (s *ListServiceAccountKeysResponse) MarshalJSON() ([]byte, error) {
  277. type noMethod ListServiceAccountKeysResponse
  278. raw := noMethod(*s)
  279. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  280. }
  281. // ListServiceAccountsResponse: The service account list response.
  282. type ListServiceAccountsResponse struct {
  283. // Accounts: The list of matching service accounts.
  284. Accounts []*ServiceAccount `json:"accounts,omitempty"`
  285. // NextPageToken: To retrieve the next page of results, set
  286. // [ListServiceAccountsRequest.page_token] to this value.
  287. NextPageToken string `json:"nextPageToken,omitempty"`
  288. // ServerResponse contains the HTTP response code and headers from the
  289. // server.
  290. googleapi.ServerResponse `json:"-"`
  291. // ForceSendFields is a list of field names (e.g. "Accounts") to
  292. // unconditionally include in API requests. By default, fields with
  293. // empty values are omitted from API requests. However, any non-pointer,
  294. // non-interface field appearing in ForceSendFields will be sent to the
  295. // server regardless of whether the field is empty or not. This may be
  296. // used to include empty fields in Patch requests.
  297. ForceSendFields []string `json:"-"`
  298. }
  299. func (s *ListServiceAccountsResponse) MarshalJSON() ([]byte, error) {
  300. type noMethod ListServiceAccountsResponse
  301. raw := noMethod(*s)
  302. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  303. }
  304. // LogConfig: Specifies what kind of log the caller must write Increment
  305. // a streamz counter with the specified metric and field names. Metric
  306. // names should start with a '/', generally be lowercase-only, and end
  307. // in "_count". Field names should not contain an initial slash. The
  308. // actual exported metric names will have "/iam/policy" prepended. Field
  309. // names correspond to IAM request parameters and field values are their
  310. // respective values. At present only "iam_principal", corresponding to
  311. // IAMContext.principal, is supported. Examples: counter { metric:
  312. // "/debug_access_count" field: "iam_principal" } ==> increment counter
  313. // /iam/policy/backend_debug_access_count {iam_principal=[value of
  314. // IAMContext.principal]} At this time we do not support: * multiple
  315. // field names (though this may be supported in the future) *
  316. // decrementing the counter * incrementing it by anything other than 1
  317. type LogConfig struct {
  318. // CloudAudit: Cloud audit options.
  319. CloudAudit *CloudAuditOptions `json:"cloudAudit,omitempty"`
  320. // Counter: Counter options.
  321. Counter *CounterOptions `json:"counter,omitempty"`
  322. // DataAccess: Data access options.
  323. DataAccess *DataAccessOptions `json:"dataAccess,omitempty"`
  324. // ForceSendFields is a list of field names (e.g. "CloudAudit") to
  325. // unconditionally include in API requests. By default, fields with
  326. // empty values are omitted from API requests. However, any non-pointer,
  327. // non-interface field appearing in ForceSendFields will be sent to the
  328. // server regardless of whether the field is empty or not. This may be
  329. // used to include empty fields in Patch requests.
  330. ForceSendFields []string `json:"-"`
  331. }
  332. func (s *LogConfig) MarshalJSON() ([]byte, error) {
  333. type noMethod LogConfig
  334. raw := noMethod(*s)
  335. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  336. }
  337. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  338. // used to specify access control policies for Cloud Platform resources.
  339. // A `Policy` consists of a list of `bindings`. A `Binding` binds a list
  340. // of `members` to a `role`, where the members can be user accounts,
  341. // Google groups, Google domains, and service accounts. A `role` is a
  342. // named list of permissions defined by IAM. **Example** { "bindings": [
  343. // { "role": "roles/owner", "members": [ "user:mike@example.com",
  344. // "group:admins@example.com", "domain:google.com",
  345. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, {
  346. // "role": "roles/viewer", "members": ["user:sean@example.com"] } ] }
  347. // For a description of IAM and its features, see the [IAM developer's
  348. // guide](https://cloud.google.com/iam).
  349. type Policy struct {
  350. // Bindings: Associates a list of `members` to a `role`. Multiple
  351. // `bindings` must not be specified for the same `role`. `bindings` with
  352. // no members will result in an error.
  353. Bindings []*Binding `json:"bindings,omitempty"`
  354. // Etag: `etag` is used for optimistic concurrency control as a way to
  355. // help prevent simultaneous updates of a policy from overwriting each
  356. // other. It is strongly suggested that systems make use of the `etag`
  357. // in the read-modify-write cycle to perform policy updates in order to
  358. // avoid race conditions: An `etag` is returned in the response to
  359. // `getIamPolicy`, and systems are expected to put that etag in the
  360. // request to `setIamPolicy` to ensure that their change will be applied
  361. // to the same version of the policy. If no `etag` is provided in the
  362. // call to `setIamPolicy`, then the existing policy is overwritten
  363. // blindly.
  364. Etag string `json:"etag,omitempty"`
  365. Rules []*Rule `json:"rules,omitempty"`
  366. // Version: Version of the `Policy`. The default version is 0.
  367. Version int64 `json:"version,omitempty"`
  368. // ServerResponse contains the HTTP response code and headers from the
  369. // server.
  370. googleapi.ServerResponse `json:"-"`
  371. // ForceSendFields is a list of field names (e.g. "Bindings") to
  372. // unconditionally include in API requests. By default, fields with
  373. // empty values are omitted from API requests. However, any non-pointer,
  374. // non-interface field appearing in ForceSendFields will be sent to the
  375. // server regardless of whether the field is empty or not. This may be
  376. // used to include empty fields in Patch requests.
  377. ForceSendFields []string `json:"-"`
  378. }
  379. func (s *Policy) MarshalJSON() ([]byte, error) {
  380. type noMethod Policy
  381. raw := noMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  383. }
  384. // Rule: A rule to be applied in a Policy.
  385. type Rule struct {
  386. // Action: Required
  387. //
  388. // Possible values:
  389. // "NO_ACTION"
  390. // "ALLOW"
  391. // "ALLOW_WITH_LOG"
  392. // "DENY"
  393. // "DENY_WITH_LOG"
  394. // "LOG"
  395. Action string `json:"action,omitempty"`
  396. // Conditions: Additional restrictions that must be met
  397. Conditions []*Condition `json:"conditions,omitempty"`
  398. // Description: Human-readable description of the rule.
  399. Description string `json:"description,omitempty"`
  400. // In: The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this
  401. // set of entries.
  402. In []string `json:"in,omitempty"`
  403. // LogConfig: The config returned to callers of tech.iam.IAM.CheckPolicy
  404. // for any entries that match the LOG action.
  405. LogConfig []*LogConfig `json:"logConfig,omitempty"`
  406. // NotIn: The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in
  407. // this set of entries. The format for in and not_in entries is the same
  408. // as for members in a Binding (see google/iam/v1/policy.proto).
  409. NotIn []string `json:"notIn,omitempty"`
  410. // Permissions: A permission is a string of form '..' (e.g.,
  411. // 'storage.buckets.list'). A value of '*' matches all permissions, and
  412. // a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.
  413. Permissions []string `json:"permissions,omitempty"`
  414. // ForceSendFields is a list of field names (e.g. "Action") to
  415. // unconditionally include in API requests. By default, fields with
  416. // empty values are omitted from API requests. However, any non-pointer,
  417. // non-interface field appearing in ForceSendFields will be sent to the
  418. // server regardless of whether the field is empty or not. This may be
  419. // used to include empty fields in Patch requests.
  420. ForceSendFields []string `json:"-"`
  421. }
  422. func (s *Rule) MarshalJSON() ([]byte, error) {
  423. type noMethod Rule
  424. raw := noMethod(*s)
  425. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  426. }
  427. // ServiceAccount: A service account in the Identity and Access
  428. // Management API. To create a service account, you specify the
  429. // project_id and account_id for the account. The account_id is unique
  430. // within the project, and used to generate the service account email
  431. // address and a stable unique id. All other methods can identify
  432. // accounts using the format
  433. // "projects/{project}/serviceAccounts/{account}". Using '-' as a
  434. // wildcard for the project, will infer the project from the account.
  435. // The account value can be the email address or the unique_id of the
  436. // service account.
  437. type ServiceAccount struct {
  438. // DisplayName: Optional. A user-specified description of the service
  439. // account. Must be fewer than 100 UTF-8 bytes.
  440. DisplayName string `json:"displayName,omitempty"`
  441. // Email: @OutputOnly Email address of the service account.
  442. Email string `json:"email,omitempty"`
  443. // Etag: Used to perform a consistent read-modify-write.
  444. Etag string `json:"etag,omitempty"`
  445. // Name: The resource name of the service account in the format
  446. // "projects/{project}/serviceAccounts/{account}". In requests using '-'
  447. // as a wildcard for the project, will infer the project from the
  448. // account and the account value can be the email address or the
  449. // unique_id of the service account. In responses the resource name will
  450. // always be in the format "projects/{project}/serviceAccounts/{email}".
  451. Name string `json:"name,omitempty"`
  452. // Oauth2ClientId: @OutputOnly. The OAuth2 client id for the service
  453. // account. This is used in conjunction with the OAuth2 clientconfig API
  454. // to make three legged OAuth2 (3LO) flows to access the data of Google
  455. // users.
  456. Oauth2ClientId string `json:"oauth2ClientId,omitempty"`
  457. // ProjectId: @OutputOnly The id of the project that owns the service
  458. // account.
  459. ProjectId string `json:"projectId,omitempty"`
  460. // UniqueId: @OutputOnly unique and stable id of the service account.
  461. UniqueId string `json:"uniqueId,omitempty"`
  462. // ServerResponse contains the HTTP response code and headers from the
  463. // server.
  464. googleapi.ServerResponse `json:"-"`
  465. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  466. // unconditionally include in API requests. By default, fields with
  467. // empty values are omitted from API requests. However, any non-pointer,
  468. // non-interface field appearing in ForceSendFields will be sent to the
  469. // server regardless of whether the field is empty or not. This may be
  470. // used to include empty fields in Patch requests.
  471. ForceSendFields []string `json:"-"`
  472. }
  473. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  474. type noMethod ServiceAccount
  475. raw := noMethod(*s)
  476. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  477. }
  478. // ServiceAccountKey: Represents a service account key. A service
  479. // account can have 0 or more key pairs. The private keys for these are
  480. // not stored by Google. ServiceAccountKeys are immutable.
  481. type ServiceAccountKey struct {
  482. // Name: The resource name of the service account key in the format
  483. // "projects/{project}/serviceAccounts/{email}/keys/{key}".
  484. Name string `json:"name,omitempty"`
  485. // PrivateKeyData: The key data.
  486. PrivateKeyData string `json:"privateKeyData,omitempty"`
  487. // PrivateKeyType: The type of the private key.
  488. //
  489. // Possible values:
  490. // "TYPE_UNSPECIFIED"
  491. // "TYPE_PKCS12_FILE"
  492. // "TYPE_GOOGLE_CREDENTIALS_FILE"
  493. PrivateKeyType string `json:"privateKeyType,omitempty"`
  494. // ValidAfterTime: The key can be used after this timestamp.
  495. ValidAfterTime string `json:"validAfterTime,omitempty"`
  496. // ValidBeforeTime: The key can be used before this timestamp.
  497. ValidBeforeTime string `json:"validBeforeTime,omitempty"`
  498. // ServerResponse contains the HTTP response code and headers from the
  499. // server.
  500. googleapi.ServerResponse `json:"-"`
  501. // ForceSendFields is a list of field names (e.g. "Name") to
  502. // unconditionally include in API requests. By default, fields with
  503. // empty values are omitted from API requests. However, any non-pointer,
  504. // non-interface field appearing in ForceSendFields will be sent to the
  505. // server regardless of whether the field is empty or not. This may be
  506. // used to include empty fields in Patch requests.
  507. ForceSendFields []string `json:"-"`
  508. }
  509. func (s *ServiceAccountKey) MarshalJSON() ([]byte, error) {
  510. type noMethod ServiceAccountKey
  511. raw := noMethod(*s)
  512. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  513. }
  514. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  515. type SetIamPolicyRequest struct {
  516. // Policy: REQUIRED: The complete policy to be applied to the
  517. // `resource`. The size of the policy is limited to a few 10s of KB. An
  518. // empty policy is a valid policy but certain Cloud Platform services
  519. // (such as Projects) might reject them.
  520. Policy *Policy `json:"policy,omitempty"`
  521. // ForceSendFields is a list of field names (e.g. "Policy") to
  522. // unconditionally include in API requests. By default, fields with
  523. // empty values are omitted from API requests. However, any non-pointer,
  524. // non-interface field appearing in ForceSendFields will be sent to the
  525. // server regardless of whether the field is empty or not. This may be
  526. // used to include empty fields in Patch requests.
  527. ForceSendFields []string `json:"-"`
  528. }
  529. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  530. type noMethod SetIamPolicyRequest
  531. raw := noMethod(*s)
  532. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  533. }
  534. // SignBlobRequest: The service account sign blob request.
  535. type SignBlobRequest struct {
  536. // BytesToSign: The bytes to sign
  537. BytesToSign string `json:"bytesToSign,omitempty"`
  538. // ForceSendFields is a list of field names (e.g. "BytesToSign") to
  539. // unconditionally include in API requests. By default, fields with
  540. // empty values are omitted from API requests. However, any non-pointer,
  541. // non-interface field appearing in ForceSendFields will be sent to the
  542. // server regardless of whether the field is empty or not. This may be
  543. // used to include empty fields in Patch requests.
  544. ForceSendFields []string `json:"-"`
  545. }
  546. func (s *SignBlobRequest) MarshalJSON() ([]byte, error) {
  547. type noMethod SignBlobRequest
  548. raw := noMethod(*s)
  549. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  550. }
  551. // SignBlobResponse: The service account sign blob response.
  552. type SignBlobResponse struct {
  553. // KeyId: The id of the key used to sign the blob.
  554. KeyId string `json:"keyId,omitempty"`
  555. // Signature: The signed blob.
  556. Signature string `json:"signature,omitempty"`
  557. // ServerResponse contains the HTTP response code and headers from the
  558. // server.
  559. googleapi.ServerResponse `json:"-"`
  560. // ForceSendFields is a list of field names (e.g. "KeyId") to
  561. // unconditionally include in API requests. By default, fields with
  562. // empty values are omitted from API requests. However, any non-pointer,
  563. // non-interface field appearing in ForceSendFields will be sent to the
  564. // server regardless of whether the field is empty or not. This may be
  565. // used to include empty fields in Patch requests.
  566. ForceSendFields []string `json:"-"`
  567. }
  568. func (s *SignBlobResponse) MarshalJSON() ([]byte, error) {
  569. type noMethod SignBlobResponse
  570. raw := noMethod(*s)
  571. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  572. }
  573. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  574. // method.
  575. type TestIamPermissionsRequest struct {
  576. // Permissions: The set of permissions to check for the `resource`.
  577. // Permissions with wildcards (such as '*' or 'storage.*') are not
  578. // allowed. For more information see IAM Overview.
  579. Permissions []string `json:"permissions,omitempty"`
  580. // ForceSendFields is a list of field names (e.g. "Permissions") to
  581. // unconditionally include in API requests. By default, fields with
  582. // empty values are omitted from API requests. However, any non-pointer,
  583. // non-interface field appearing in ForceSendFields will be sent to the
  584. // server regardless of whether the field is empty or not. This may be
  585. // used to include empty fields in Patch requests.
  586. ForceSendFields []string `json:"-"`
  587. }
  588. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  589. type noMethod TestIamPermissionsRequest
  590. raw := noMethod(*s)
  591. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  592. }
  593. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  594. // method.
  595. type TestIamPermissionsResponse struct {
  596. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  597. // the caller is allowed.
  598. Permissions []string `json:"permissions,omitempty"`
  599. // ServerResponse contains the HTTP response code and headers from the
  600. // server.
  601. googleapi.ServerResponse `json:"-"`
  602. // ForceSendFields is a list of field names (e.g. "Permissions") to
  603. // unconditionally include in API requests. By default, fields with
  604. // empty values are omitted from API requests. However, any non-pointer,
  605. // non-interface field appearing in ForceSendFields will be sent to the
  606. // server regardless of whether the field is empty or not. This may be
  607. // used to include empty fields in Patch requests.
  608. ForceSendFields []string `json:"-"`
  609. }
  610. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  611. type noMethod TestIamPermissionsResponse
  612. raw := noMethod(*s)
  613. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  614. }
  615. // method id "iam.projects.serviceAccounts.create":
  616. type ProjectsServiceAccountsCreateCall struct {
  617. s *Service
  618. name string
  619. createserviceaccountrequest *CreateServiceAccountRequest
  620. urlParams_ gensupport.URLParams
  621. ctx_ context.Context
  622. }
  623. // Create: Creates a service account and returns it.
  624. func (r *ProjectsServiceAccountsService) Create(name string, createserviceaccountrequest *CreateServiceAccountRequest) *ProjectsServiceAccountsCreateCall {
  625. c := &ProjectsServiceAccountsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  626. c.name = name
  627. c.createserviceaccountrequest = createserviceaccountrequest
  628. return c
  629. }
  630. // Fields allows partial responses to be retrieved. See
  631. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  632. // for more information.
  633. func (c *ProjectsServiceAccountsCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsCreateCall {
  634. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  635. return c
  636. }
  637. // Context sets the context to be used in this call's Do method. Any
  638. // pending HTTP request will be aborted if the provided context is
  639. // canceled.
  640. func (c *ProjectsServiceAccountsCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsCreateCall {
  641. c.ctx_ = ctx
  642. return c
  643. }
  644. func (c *ProjectsServiceAccountsCreateCall) doRequest(alt string) (*http.Response, error) {
  645. var body io.Reader = nil
  646. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountrequest)
  647. if err != nil {
  648. return nil, err
  649. }
  650. ctype := "application/json"
  651. c.urlParams_.Set("alt", alt)
  652. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  653. urls += "?" + c.urlParams_.Encode()
  654. req, _ := http.NewRequest("POST", urls, body)
  655. googleapi.Expand(req.URL, map[string]string{
  656. "name": c.name,
  657. })
  658. req.Header.Set("Content-Type", ctype)
  659. req.Header.Set("User-Agent", c.s.userAgent())
  660. if c.ctx_ != nil {
  661. return ctxhttp.Do(c.ctx_, c.s.client, req)
  662. }
  663. return c.s.client.Do(req)
  664. }
  665. // Do executes the "iam.projects.serviceAccounts.create" call.
  666. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  667. // status code is an error. Response headers are in either
  668. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  669. // at all) in error.(*googleapi.Error).Header. Use
  670. // googleapi.IsNotModified to check whether the returned error was
  671. // because http.StatusNotModified was returned.
  672. func (c *ProjectsServiceAccountsCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  673. gensupport.SetOptions(c.urlParams_, opts...)
  674. res, err := c.doRequest("json")
  675. if res != nil && res.StatusCode == http.StatusNotModified {
  676. if res.Body != nil {
  677. res.Body.Close()
  678. }
  679. return nil, &googleapi.Error{
  680. Code: res.StatusCode,
  681. Header: res.Header,
  682. }
  683. }
  684. if err != nil {
  685. return nil, err
  686. }
  687. defer googleapi.CloseBody(res)
  688. if err := googleapi.CheckResponse(res); err != nil {
  689. return nil, err
  690. }
  691. ret := &ServiceAccount{
  692. ServerResponse: googleapi.ServerResponse{
  693. Header: res.Header,
  694. HTTPStatusCode: res.StatusCode,
  695. },
  696. }
  697. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  698. return nil, err
  699. }
  700. return ret, nil
  701. // {
  702. // "description": "Creates a service account and returns it.",
  703. // "httpMethod": "POST",
  704. // "id": "iam.projects.serviceAccounts.create",
  705. // "parameterOrder": [
  706. // "name"
  707. // ],
  708. // "parameters": {
  709. // "name": {
  710. // "description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"",
  711. // "location": "path",
  712. // "pattern": "^projects/[^/]*$",
  713. // "required": true,
  714. // "type": "string"
  715. // }
  716. // },
  717. // "path": "v1/{+name}/serviceAccounts",
  718. // "request": {
  719. // "$ref": "CreateServiceAccountRequest"
  720. // },
  721. // "response": {
  722. // "$ref": "ServiceAccount"
  723. // },
  724. // "scopes": [
  725. // "https://www.googleapis.com/auth/cloud-platform"
  726. // ]
  727. // }
  728. }
  729. // method id "iam.projects.serviceAccounts.delete":
  730. type ProjectsServiceAccountsDeleteCall struct {
  731. s *Service
  732. name string
  733. urlParams_ gensupport.URLParams
  734. ctx_ context.Context
  735. }
  736. // Delete: Deletes a service acount.
  737. func (r *ProjectsServiceAccountsService) Delete(name string) *ProjectsServiceAccountsDeleteCall {
  738. c := &ProjectsServiceAccountsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  739. c.name = name
  740. return c
  741. }
  742. // Fields allows partial responses to be retrieved. See
  743. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  744. // for more information.
  745. func (c *ProjectsServiceAccountsDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsDeleteCall {
  746. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  747. return c
  748. }
  749. // Context sets the context to be used in this call's Do method. Any
  750. // pending HTTP request will be aborted if the provided context is
  751. // canceled.
  752. func (c *ProjectsServiceAccountsDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsDeleteCall {
  753. c.ctx_ = ctx
  754. return c
  755. }
  756. func (c *ProjectsServiceAccountsDeleteCall) doRequest(alt string) (*http.Response, error) {
  757. var body io.Reader = nil
  758. c.urlParams_.Set("alt", alt)
  759. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  760. urls += "?" + c.urlParams_.Encode()
  761. req, _ := http.NewRequest("DELETE", urls, body)
  762. googleapi.Expand(req.URL, map[string]string{
  763. "name": c.name,
  764. })
  765. req.Header.Set("User-Agent", c.s.userAgent())
  766. if c.ctx_ != nil {
  767. return ctxhttp.Do(c.ctx_, c.s.client, req)
  768. }
  769. return c.s.client.Do(req)
  770. }
  771. // Do executes the "iam.projects.serviceAccounts.delete" call.
  772. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  773. // code is an error. Response headers are in either
  774. // *Empty.ServerResponse.Header or (if a response was returned at all)
  775. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  776. // check whether the returned error was because http.StatusNotModified
  777. // was returned.
  778. func (c *ProjectsServiceAccountsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  779. gensupport.SetOptions(c.urlParams_, opts...)
  780. res, err := c.doRequest("json")
  781. if res != nil && res.StatusCode == http.StatusNotModified {
  782. if res.Body != nil {
  783. res.Body.Close()
  784. }
  785. return nil, &googleapi.Error{
  786. Code: res.StatusCode,
  787. Header: res.Header,
  788. }
  789. }
  790. if err != nil {
  791. return nil, err
  792. }
  793. defer googleapi.CloseBody(res)
  794. if err := googleapi.CheckResponse(res); err != nil {
  795. return nil, err
  796. }
  797. ret := &Empty{
  798. ServerResponse: googleapi.ServerResponse{
  799. Header: res.Header,
  800. HTTPStatusCode: res.StatusCode,
  801. },
  802. }
  803. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  804. return nil, err
  805. }
  806. return ret, nil
  807. // {
  808. // "description": "Deletes a service acount.",
  809. // "httpMethod": "DELETE",
  810. // "id": "iam.projects.serviceAccounts.delete",
  811. // "parameterOrder": [
  812. // "name"
  813. // ],
  814. // "parameters": {
  815. // "name": {
  816. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  817. // "location": "path",
  818. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  819. // "required": true,
  820. // "type": "string"
  821. // }
  822. // },
  823. // "path": "v1/{+name}",
  824. // "response": {
  825. // "$ref": "Empty"
  826. // },
  827. // "scopes": [
  828. // "https://www.googleapis.com/auth/cloud-platform"
  829. // ]
  830. // }
  831. }
  832. // method id "iam.projects.serviceAccounts.get":
  833. type ProjectsServiceAccountsGetCall struct {
  834. s *Service
  835. name string
  836. urlParams_ gensupport.URLParams
  837. ifNoneMatch_ string
  838. ctx_ context.Context
  839. }
  840. // Get: Gets a ServiceAccount
  841. func (r *ProjectsServiceAccountsService) Get(name string) *ProjectsServiceAccountsGetCall {
  842. c := &ProjectsServiceAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  843. c.name = name
  844. return c
  845. }
  846. // Fields allows partial responses to be retrieved. See
  847. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  848. // for more information.
  849. func (c *ProjectsServiceAccountsGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetCall {
  850. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  851. return c
  852. }
  853. // IfNoneMatch sets the optional parameter which makes the operation
  854. // fail if the object's ETag matches the given value. This is useful for
  855. // getting updates only after the object has changed since the last
  856. // request. Use googleapi.IsNotModified to check whether the response
  857. // error from Do is the result of In-None-Match.
  858. func (c *ProjectsServiceAccountsGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsGetCall {
  859. c.ifNoneMatch_ = entityTag
  860. return c
  861. }
  862. // Context sets the context to be used in this call's Do method. Any
  863. // pending HTTP request will be aborted if the provided context is
  864. // canceled.
  865. func (c *ProjectsServiceAccountsGetCall) Context(ctx context.Context) *ProjectsServiceAccountsGetCall {
  866. c.ctx_ = ctx
  867. return c
  868. }
  869. func (c *ProjectsServiceAccountsGetCall) doRequest(alt string) (*http.Response, error) {
  870. var body io.Reader = nil
  871. c.urlParams_.Set("alt", alt)
  872. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  873. urls += "?" + c.urlParams_.Encode()
  874. req, _ := http.NewRequest("GET", urls, body)
  875. googleapi.Expand(req.URL, map[string]string{
  876. "name": c.name,
  877. })
  878. req.Header.Set("User-Agent", c.s.userAgent())
  879. if c.ifNoneMatch_ != "" {
  880. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  881. }
  882. if c.ctx_ != nil {
  883. return ctxhttp.Do(c.ctx_, c.s.client, req)
  884. }
  885. return c.s.client.Do(req)
  886. }
  887. // Do executes the "iam.projects.serviceAccounts.get" call.
  888. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  889. // status code is an error. Response headers are in either
  890. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  891. // at all) in error.(*googleapi.Error).Header. Use
  892. // googleapi.IsNotModified to check whether the returned error was
  893. // because http.StatusNotModified was returned.
  894. func (c *ProjectsServiceAccountsGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  895. gensupport.SetOptions(c.urlParams_, opts...)
  896. res, err := c.doRequest("json")
  897. if res != nil && res.StatusCode == http.StatusNotModified {
  898. if res.Body != nil {
  899. res.Body.Close()
  900. }
  901. return nil, &googleapi.Error{
  902. Code: res.StatusCode,
  903. Header: res.Header,
  904. }
  905. }
  906. if err != nil {
  907. return nil, err
  908. }
  909. defer googleapi.CloseBody(res)
  910. if err := googleapi.CheckResponse(res); err != nil {
  911. return nil, err
  912. }
  913. ret := &ServiceAccount{
  914. ServerResponse: googleapi.ServerResponse{
  915. Header: res.Header,
  916. HTTPStatusCode: res.StatusCode,
  917. },
  918. }
  919. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  920. return nil, err
  921. }
  922. return ret, nil
  923. // {
  924. // "description": "Gets a ServiceAccount",
  925. // "httpMethod": "GET",
  926. // "id": "iam.projects.serviceAccounts.get",
  927. // "parameterOrder": [
  928. // "name"
  929. // ],
  930. // "parameters": {
  931. // "name": {
  932. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  933. // "location": "path",
  934. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  935. // "required": true,
  936. // "type": "string"
  937. // }
  938. // },
  939. // "path": "v1/{+name}",
  940. // "response": {
  941. // "$ref": "ServiceAccount"
  942. // },
  943. // "scopes": [
  944. // "https://www.googleapis.com/auth/cloud-platform"
  945. // ]
  946. // }
  947. }
  948. // method id "iam.projects.serviceAccounts.getIamPolicy":
  949. type ProjectsServiceAccountsGetIamPolicyCall struct {
  950. s *Service
  951. resource string
  952. urlParams_ gensupport.URLParams
  953. ctx_ context.Context
  954. }
  955. // GetIamPolicy: Returns the IAM access control policy for specified IAM
  956. // resource.
  957. func (r *ProjectsServiceAccountsService) GetIamPolicy(resource string) *ProjectsServiceAccountsGetIamPolicyCall {
  958. c := &ProjectsServiceAccountsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  959. c.resource = resource
  960. return c
  961. }
  962. // Fields allows partial responses to be retrieved. See
  963. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  964. // for more information.
  965. func (c *ProjectsServiceAccountsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetIamPolicyCall {
  966. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  967. return c
  968. }
  969. // Context sets the context to be used in this call's Do method. Any
  970. // pending HTTP request will be aborted if the provided context is
  971. // canceled.
  972. func (c *ProjectsServiceAccountsGetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsGetIamPolicyCall {
  973. c.ctx_ = ctx
  974. return c
  975. }
  976. func (c *ProjectsServiceAccountsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  977. var body io.Reader = nil
  978. c.urlParams_.Set("alt", alt)
  979. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  980. urls += "?" + c.urlParams_.Encode()
  981. req, _ := http.NewRequest("POST", urls, body)
  982. googleapi.Expand(req.URL, map[string]string{
  983. "resource": c.resource,
  984. })
  985. req.Header.Set("User-Agent", c.s.userAgent())
  986. if c.ctx_ != nil {
  987. return ctxhttp.Do(c.ctx_, c.s.client, req)
  988. }
  989. return c.s.client.Do(req)
  990. }
  991. // Do executes the "iam.projects.serviceAccounts.getIamPolicy" call.
  992. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  993. // code is an error. Response headers are in either
  994. // *Policy.ServerResponse.Header or (if a response was returned at all)
  995. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  996. // check whether the returned error was because http.StatusNotModified
  997. // was returned.
  998. func (c *ProjectsServiceAccountsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  999. gensupport.SetOptions(c.urlParams_, opts...)
  1000. res, err := c.doRequest("json")
  1001. if res != nil && res.StatusCode == http.StatusNotModified {
  1002. if res.Body != nil {
  1003. res.Body.Close()
  1004. }
  1005. return nil, &googleapi.Error{
  1006. Code: res.StatusCode,
  1007. Header: res.Header,
  1008. }
  1009. }
  1010. if err != nil {
  1011. return nil, err
  1012. }
  1013. defer googleapi.CloseBody(res)
  1014. if err := googleapi.CheckResponse(res); err != nil {
  1015. return nil, err
  1016. }
  1017. ret := &Policy{
  1018. ServerResponse: googleapi.ServerResponse{
  1019. Header: res.Header,
  1020. HTTPStatusCode: res.StatusCode,
  1021. },
  1022. }
  1023. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1024. return nil, err
  1025. }
  1026. return ret, nil
  1027. // {
  1028. // "description": "Returns the IAM access control policy for specified IAM resource.",
  1029. // "httpMethod": "POST",
  1030. // "id": "iam.projects.serviceAccounts.getIamPolicy",
  1031. // "parameterOrder": [
  1032. // "resource"
  1033. // ],
  1034. // "parameters": {
  1035. // "resource": {
  1036. // "description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.",
  1037. // "location": "path",
  1038. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1039. // "required": true,
  1040. // "type": "string"
  1041. // }
  1042. // },
  1043. // "path": "v1/{+resource}:getIamPolicy",
  1044. // "response": {
  1045. // "$ref": "Policy"
  1046. // },
  1047. // "scopes": [
  1048. // "https://www.googleapis.com/auth/cloud-platform"
  1049. // ]
  1050. // }
  1051. }
  1052. // method id "iam.projects.serviceAccounts.list":
  1053. type ProjectsServiceAccountsListCall struct {
  1054. s *Service
  1055. name string
  1056. urlParams_ gensupport.URLParams
  1057. ifNoneMatch_ string
  1058. ctx_ context.Context
  1059. }
  1060. // List: Lists service accounts for a project.
  1061. func (r *ProjectsServiceAccountsService) List(name string) *ProjectsServiceAccountsListCall {
  1062. c := &ProjectsServiceAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1063. c.name = name
  1064. return c
  1065. }
  1066. // PageSize sets the optional parameter "pageSize": Optional limit on
  1067. // the number of service accounts to include in the response. Further
  1068. // accounts can subsequently be obtained by including the
  1069. // [ListServiceAccountsResponse.next_page_token] in a subsequent
  1070. // request.
  1071. func (c *ProjectsServiceAccountsListCall) PageSize(pageSize int64) *ProjectsServiceAccountsListCall {
  1072. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1073. return c
  1074. }
  1075. // PageToken sets the optional parameter "pageToken": Optional
  1076. // pagination token returned in an earlier
  1077. // [ListServiceAccountsResponse.next_page_token].
  1078. func (c *ProjectsServiceAccountsListCall) PageToken(pageToken string) *ProjectsServiceAccountsListCall {
  1079. c.urlParams_.Set("pageToken", pageToken)
  1080. return c
  1081. }
  1082. // Fields allows partial responses to be retrieved. See
  1083. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1084. // for more information.
  1085. func (c *ProjectsServiceAccountsListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsListCall {
  1086. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1087. return c
  1088. }
  1089. // IfNoneMatch sets the optional parameter which makes the operation
  1090. // fail if the object's ETag matches the given value. This is useful for
  1091. // getting updates only after the object has changed since the last
  1092. // request. Use googleapi.IsNotModified to check whether the response
  1093. // error from Do is the result of In-None-Match.
  1094. func (c *ProjectsServiceAccountsListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsListCall {
  1095. c.ifNoneMatch_ = entityTag
  1096. return c
  1097. }
  1098. // Context sets the context to be used in this call's Do method. Any
  1099. // pending HTTP request will be aborted if the provided context is
  1100. // canceled.
  1101. func (c *ProjectsServiceAccountsListCall) Context(ctx context.Context) *ProjectsServiceAccountsListCall {
  1102. c.ctx_ = ctx
  1103. return c
  1104. }
  1105. func (c *ProjectsServiceAccountsListCall) doRequest(alt string) (*http.Response, error) {
  1106. var body io.Reader = nil
  1107. c.urlParams_.Set("alt", alt)
  1108. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  1109. urls += "?" + c.urlParams_.Encode()
  1110. req, _ := http.NewRequest("GET", urls, body)
  1111. googleapi.Expand(req.URL, map[string]string{
  1112. "name": c.name,
  1113. })
  1114. req.Header.Set("User-Agent", c.s.userAgent())
  1115. if c.ifNoneMatch_ != "" {
  1116. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1117. }
  1118. if c.ctx_ != nil {
  1119. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1120. }
  1121. return c.s.client.Do(req)
  1122. }
  1123. // Do executes the "iam.projects.serviceAccounts.list" call.
  1124. // Exactly one of *ListServiceAccountsResponse or error will be non-nil.
  1125. // Any non-2xx status code is an error. Response headers are in either
  1126. // *ListServiceAccountsResponse.ServerResponse.Header or (if a response
  1127. // was returned at all) in error.(*googleapi.Error).Header. Use
  1128. // googleapi.IsNotModified to check whether the returned error was
  1129. // because http.StatusNotModified was returned.
  1130. func (c *ProjectsServiceAccountsListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountsResponse, error) {
  1131. gensupport.SetOptions(c.urlParams_, opts...)
  1132. res, err := c.doRequest("json")
  1133. if res != nil && res.StatusCode == http.StatusNotModified {
  1134. if res.Body != nil {
  1135. res.Body.Close()
  1136. }
  1137. return nil, &googleapi.Error{
  1138. Code: res.StatusCode,
  1139. Header: res.Header,
  1140. }
  1141. }
  1142. if err != nil {
  1143. return nil, err
  1144. }
  1145. defer googleapi.CloseBody(res)
  1146. if err := googleapi.CheckResponse(res); err != nil {
  1147. return nil, err
  1148. }
  1149. ret := &ListServiceAccountsResponse{
  1150. ServerResponse: googleapi.ServerResponse{
  1151. Header: res.Header,
  1152. HTTPStatusCode: res.StatusCode,
  1153. },
  1154. }
  1155. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1156. return nil, err
  1157. }
  1158. return ret, nil
  1159. // {
  1160. // "description": "Lists service accounts for a project.",
  1161. // "httpMethod": "GET",
  1162. // "id": "iam.projects.serviceAccounts.list",
  1163. // "parameterOrder": [
  1164. // "name"
  1165. // ],
  1166. // "parameters": {
  1167. // "name": {
  1168. // "description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"",
  1169. // "location": "path",
  1170. // "pattern": "^projects/[^/]*$",
  1171. // "required": true,
  1172. // "type": "string"
  1173. // },
  1174. // "pageSize": {
  1175. // "description": "Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request.",
  1176. // "format": "int32",
  1177. // "location": "query",
  1178. // "type": "integer"
  1179. // },
  1180. // "pageToken": {
  1181. // "description": "Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token].",
  1182. // "location": "query",
  1183. // "type": "string"
  1184. // }
  1185. // },
  1186. // "path": "v1/{+name}/serviceAccounts",
  1187. // "response": {
  1188. // "$ref": "ListServiceAccountsResponse"
  1189. // },
  1190. // "scopes": [
  1191. // "https://www.googleapis.com/auth/cloud-platform"
  1192. // ]
  1193. // }
  1194. }
  1195. // Pages invokes f for each page of results.
  1196. // A non-nil error returned from f will halt the iteration.
  1197. // The provided context supersedes any context provided to the Context method.
  1198. func (c *ProjectsServiceAccountsListCall) Pages(ctx context.Context, f func(*ListServiceAccountsResponse) error) error {
  1199. c.ctx_ = ctx
  1200. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1201. for {
  1202. x, err := c.Do()
  1203. if err != nil {
  1204. return err
  1205. }
  1206. if err := f(x); err != nil {
  1207. return err
  1208. }
  1209. if x.NextPageToken == "" {
  1210. return nil
  1211. }
  1212. c.PageToken(x.NextPageToken)
  1213. }
  1214. }
  1215. // method id "iam.projects.serviceAccounts.setIamPolicy":
  1216. type ProjectsServiceAccountsSetIamPolicyCall struct {
  1217. s *Service
  1218. resource string
  1219. setiampolicyrequest *SetIamPolicyRequest
  1220. urlParams_ gensupport.URLParams
  1221. ctx_ context.Context
  1222. }
  1223. // SetIamPolicy: Sets the IAM access control policy for the specified
  1224. // IAM resource.
  1225. func (r *ProjectsServiceAccountsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsServiceAccountsSetIamPolicyCall {
  1226. c := &ProjectsServiceAccountsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1227. c.resource = resource
  1228. c.setiampolicyrequest = setiampolicyrequest
  1229. return c
  1230. }
  1231. // Fields allows partial responses to be retrieved. See
  1232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1233. // for more information.
  1234. func (c *ProjectsServiceAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSetIamPolicyCall {
  1235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1236. return c
  1237. }
  1238. // Context sets the context to be used in this call's Do method. Any
  1239. // pending HTTP request will be aborted if the provided context is
  1240. // canceled.
  1241. func (c *ProjectsServiceAccountsSetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsSetIamPolicyCall {
  1242. c.ctx_ = ctx
  1243. return c
  1244. }
  1245. func (c *ProjectsServiceAccountsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1246. var body io.Reader = nil
  1247. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  1248. if err != nil {
  1249. return nil, err
  1250. }
  1251. ctype := "application/json"
  1252. c.urlParams_.Set("alt", alt)
  1253. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  1254. urls += "?" + c.urlParams_.Encode()
  1255. req, _ := http.NewRequest("POST", urls, body)
  1256. googleapi.Expand(req.URL, map[string]string{
  1257. "resource": c.resource,
  1258. })
  1259. req.Header.Set("Content-Type", ctype)
  1260. req.Header.Set("User-Agent", c.s.userAgent())
  1261. if c.ctx_ != nil {
  1262. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1263. }
  1264. return c.s.client.Do(req)
  1265. }
  1266. // Do executes the "iam.projects.serviceAccounts.setIamPolicy" call.
  1267. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1268. // code is an error. Response headers are in either
  1269. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1270. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1271. // check whether the returned error was because http.StatusNotModified
  1272. // was returned.
  1273. func (c *ProjectsServiceAccountsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1274. gensupport.SetOptions(c.urlParams_, opts...)
  1275. res, err := c.doRequest("json")
  1276. if res != nil && res.StatusCode == http.StatusNotModified {
  1277. if res.Body != nil {
  1278. res.Body.Close()
  1279. }
  1280. return nil, &googleapi.Error{
  1281. Code: res.StatusCode,
  1282. Header: res.Header,
  1283. }
  1284. }
  1285. if err != nil {
  1286. return nil, err
  1287. }
  1288. defer googleapi.CloseBody(res)
  1289. if err := googleapi.CheckResponse(res); err != nil {
  1290. return nil, err
  1291. }
  1292. ret := &Policy{
  1293. ServerResponse: googleapi.ServerResponse{
  1294. Header: res.Header,
  1295. HTTPStatusCode: res.StatusCode,
  1296. },
  1297. }
  1298. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1299. return nil, err
  1300. }
  1301. return ret, nil
  1302. // {
  1303. // "description": "Sets the IAM access control policy for the specified IAM resource.",
  1304. // "httpMethod": "POST",
  1305. // "id": "iam.projects.serviceAccounts.setIamPolicy",
  1306. // "parameterOrder": [
  1307. // "resource"
  1308. // ],
  1309. // "parameters": {
  1310. // "resource": {
  1311. // "description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.",
  1312. // "location": "path",
  1313. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1314. // "required": true,
  1315. // "type": "string"
  1316. // }
  1317. // },
  1318. // "path": "v1/{+resource}:setIamPolicy",
  1319. // "request": {
  1320. // "$ref": "SetIamPolicyRequest"
  1321. // },
  1322. // "response": {
  1323. // "$ref": "Policy"
  1324. // },
  1325. // "scopes": [
  1326. // "https://www.googleapis.com/auth/cloud-platform"
  1327. // ]
  1328. // }
  1329. }
  1330. // method id "iam.projects.serviceAccounts.signBlob":
  1331. type ProjectsServiceAccountsSignBlobCall struct {
  1332. s *Service
  1333. name string
  1334. signblobrequest *SignBlobRequest
  1335. urlParams_ gensupport.URLParams
  1336. ctx_ context.Context
  1337. }
  1338. // SignBlob: Signs a blob using a service account.
  1339. func (r *ProjectsServiceAccountsService) SignBlob(name string, signblobrequest *SignBlobRequest) *ProjectsServiceAccountsSignBlobCall {
  1340. c := &ProjectsServiceAccountsSignBlobCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1341. c.name = name
  1342. c.signblobrequest = signblobrequest
  1343. return c
  1344. }
  1345. // Fields allows partial responses to be retrieved. See
  1346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1347. // for more information.
  1348. func (c *ProjectsServiceAccountsSignBlobCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignBlobCall {
  1349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1350. return c
  1351. }
  1352. // Context sets the context to be used in this call's Do method. Any
  1353. // pending HTTP request will be aborted if the provided context is
  1354. // canceled.
  1355. func (c *ProjectsServiceAccountsSignBlobCall) Context(ctx context.Context) *ProjectsServiceAccountsSignBlobCall {
  1356. c.ctx_ = ctx
  1357. return c
  1358. }
  1359. func (c *ProjectsServiceAccountsSignBlobCall) doRequest(alt string) (*http.Response, error) {
  1360. var body io.Reader = nil
  1361. body, err := googleapi.WithoutDataWrapper.JSONReader(c.signblobrequest)
  1362. if err != nil {
  1363. return nil, err
  1364. }
  1365. ctype := "application/json"
  1366. c.urlParams_.Set("alt", alt)
  1367. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:signBlob")
  1368. urls += "?" + c.urlParams_.Encode()
  1369. req, _ := http.NewRequest("POST", urls, body)
  1370. googleapi.Expand(req.URL, map[string]string{
  1371. "name": c.name,
  1372. })
  1373. req.Header.Set("Content-Type", ctype)
  1374. req.Header.Set("User-Agent", c.s.userAgent())
  1375. if c.ctx_ != nil {
  1376. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1377. }
  1378. return c.s.client.Do(req)
  1379. }
  1380. // Do executes the "iam.projects.serviceAccounts.signBlob" call.
  1381. // Exactly one of *SignBlobResponse or error will be non-nil. Any
  1382. // non-2xx status code is an error. Response headers are in either
  1383. // *SignBlobResponse.ServerResponse.Header or (if a response was
  1384. // returned at all) in error.(*googleapi.Error).Header. Use
  1385. // googleapi.IsNotModified to check whether the returned error was
  1386. // because http.StatusNotModified was returned.
  1387. func (c *ProjectsServiceAccountsSignBlobCall) Do(opts ...googleapi.CallOption) (*SignBlobResponse, error) {
  1388. gensupport.SetOptions(c.urlParams_, opts...)
  1389. res, err := c.doRequest("json")
  1390. if res != nil && res.StatusCode == http.StatusNotModified {
  1391. if res.Body != nil {
  1392. res.Body.Close()
  1393. }
  1394. return nil, &googleapi.Error{
  1395. Code: res.StatusCode,
  1396. Header: res.Header,
  1397. }
  1398. }
  1399. if err != nil {
  1400. return nil, err
  1401. }
  1402. defer googleapi.CloseBody(res)
  1403. if err := googleapi.CheckResponse(res); err != nil {
  1404. return nil, err
  1405. }
  1406. ret := &SignBlobResponse{
  1407. ServerResponse: googleapi.ServerResponse{
  1408. Header: res.Header,
  1409. HTTPStatusCode: res.StatusCode,
  1410. },
  1411. }
  1412. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1413. return nil, err
  1414. }
  1415. return ret, nil
  1416. // {
  1417. // "description": "Signs a blob using a service account.",
  1418. // "httpMethod": "POST",
  1419. // "id": "iam.projects.serviceAccounts.signBlob",
  1420. // "parameterOrder": [
  1421. // "name"
  1422. // ],
  1423. // "parameters": {
  1424. // "name": {
  1425. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  1426. // "location": "path",
  1427. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1428. // "required": true,
  1429. // "type": "string"
  1430. // }
  1431. // },
  1432. // "path": "v1/{+name}:signBlob",
  1433. // "request": {
  1434. // "$ref": "SignBlobRequest"
  1435. // },
  1436. // "response": {
  1437. // "$ref": "SignBlobResponse"
  1438. // },
  1439. // "scopes": [
  1440. // "https://www.googleapis.com/auth/cloud-platform"
  1441. // ]
  1442. // }
  1443. }
  1444. // method id "iam.projects.serviceAccounts.testIamPermissions":
  1445. type ProjectsServiceAccountsTestIamPermissionsCall struct {
  1446. s *Service
  1447. resource string
  1448. testiampermissionsrequest *TestIamPermissionsRequest
  1449. urlParams_ gensupport.URLParams
  1450. ctx_ context.Context
  1451. }
  1452. // TestIamPermissions: Tests the specified permissions against the IAM
  1453. // access control policy for the specified IAM resource.
  1454. func (r *ProjectsServiceAccountsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsServiceAccountsTestIamPermissionsCall {
  1455. c := &ProjectsServiceAccountsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1456. c.resource = resource
  1457. c.testiampermissionsrequest = testiampermissionsrequest
  1458. return c
  1459. }
  1460. // Fields allows partial responses to be retrieved. See
  1461. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1462. // for more information.
  1463. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsTestIamPermissionsCall {
  1464. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1465. return c
  1466. }
  1467. // Context sets the context to be used in this call's Do method. Any
  1468. // pending HTTP request will be aborted if the provided context is
  1469. // canceled.
  1470. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsServiceAccountsTestIamPermissionsCall {
  1471. c.ctx_ = ctx
  1472. return c
  1473. }
  1474. func (c *ProjectsServiceAccountsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  1475. var body io.Reader = nil
  1476. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  1477. if err != nil {
  1478. return nil, err
  1479. }
  1480. ctype := "application/json"
  1481. c.urlParams_.Set("alt", alt)
  1482. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  1483. urls += "?" + c.urlParams_.Encode()
  1484. req, _ := http.NewRequest("POST", urls, body)
  1485. googleapi.Expand(req.URL, map[string]string{
  1486. "resource": c.resource,
  1487. })
  1488. req.Header.Set("Content-Type", ctype)
  1489. req.Header.Set("User-Agent", c.s.userAgent())
  1490. if c.ctx_ != nil {
  1491. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1492. }
  1493. return c.s.client.Do(req)
  1494. }
  1495. // Do executes the "iam.projects.serviceAccounts.testIamPermissions" call.
  1496. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  1497. // Any non-2xx status code is an error. Response headers are in either
  1498. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  1499. // was returned at all) in error.(*googleapi.Error).Header. Use
  1500. // googleapi.IsNotModified to check whether the returned error was
  1501. // because http.StatusNotModified was returned.
  1502. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  1503. gensupport.SetOptions(c.urlParams_, opts...)
  1504. res, err := c.doRequest("json")
  1505. if res != nil && res.StatusCode == http.StatusNotModified {
  1506. if res.Body != nil {
  1507. res.Body.Close()
  1508. }
  1509. return nil, &googleapi.Error{
  1510. Code: res.StatusCode,
  1511. Header: res.Header,
  1512. }
  1513. }
  1514. if err != nil {
  1515. return nil, err
  1516. }
  1517. defer googleapi.CloseBody(res)
  1518. if err := googleapi.CheckResponse(res); err != nil {
  1519. return nil, err
  1520. }
  1521. ret := &TestIamPermissionsResponse{
  1522. ServerResponse: googleapi.ServerResponse{
  1523. Header: res.Header,
  1524. HTTPStatusCode: res.StatusCode,
  1525. },
  1526. }
  1527. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1528. return nil, err
  1529. }
  1530. return ret, nil
  1531. // {
  1532. // "description": "Tests the specified permissions against the IAM access control policy for the specified IAM resource.",
  1533. // "httpMethod": "POST",
  1534. // "id": "iam.projects.serviceAccounts.testIamPermissions",
  1535. // "parameterOrder": [
  1536. // "resource"
  1537. // ],
  1538. // "parameters": {
  1539. // "resource": {
  1540. // "description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.",
  1541. // "location": "path",
  1542. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1543. // "required": true,
  1544. // "type": "string"
  1545. // }
  1546. // },
  1547. // "path": "v1/{+resource}:testIamPermissions",
  1548. // "request": {
  1549. // "$ref": "TestIamPermissionsRequest"
  1550. // },
  1551. // "response": {
  1552. // "$ref": "TestIamPermissionsResponse"
  1553. // },
  1554. // "scopes": [
  1555. // "https://www.googleapis.com/auth/cloud-platform"
  1556. // ]
  1557. // }
  1558. }
  1559. // method id "iam.projects.serviceAccounts.update":
  1560. type ProjectsServiceAccountsUpdateCall struct {
  1561. s *Service
  1562. name string
  1563. serviceaccount *ServiceAccount
  1564. urlParams_ gensupport.URLParams
  1565. ctx_ context.Context
  1566. }
  1567. // Update: Updates a service account. Currently, only the following
  1568. // fields are updatable: 'display_name' . The 'etag' is mandatory.
  1569. func (r *ProjectsServiceAccountsService) Update(name string, serviceaccount *ServiceAccount) *ProjectsServiceAccountsUpdateCall {
  1570. c := &ProjectsServiceAccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1571. c.name = name
  1572. c.serviceaccount = serviceaccount
  1573. return c
  1574. }
  1575. // Fields allows partial responses to be retrieved. See
  1576. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1577. // for more information.
  1578. func (c *ProjectsServiceAccountsUpdateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsUpdateCall {
  1579. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1580. return c
  1581. }
  1582. // Context sets the context to be used in this call's Do method. Any
  1583. // pending HTTP request will be aborted if the provided context is
  1584. // canceled.
  1585. func (c *ProjectsServiceAccountsUpdateCall) Context(ctx context.Context) *ProjectsServiceAccountsUpdateCall {
  1586. c.ctx_ = ctx
  1587. return c
  1588. }
  1589. func (c *ProjectsServiceAccountsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1590. var body io.Reader = nil
  1591. body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceaccount)
  1592. if err != nil {
  1593. return nil, err
  1594. }
  1595. ctype := "application/json"
  1596. c.urlParams_.Set("alt", alt)
  1597. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1598. urls += "?" + c.urlParams_.Encode()
  1599. req, _ := http.NewRequest("PUT", urls, body)
  1600. googleapi.Expand(req.URL, map[string]string{
  1601. "name": c.name,
  1602. })
  1603. req.Header.Set("Content-Type", ctype)
  1604. req.Header.Set("User-Agent", c.s.userAgent())
  1605. if c.ctx_ != nil {
  1606. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1607. }
  1608. return c.s.client.Do(req)
  1609. }
  1610. // Do executes the "iam.projects.serviceAccounts.update" call.
  1611. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  1612. // status code is an error. Response headers are in either
  1613. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  1614. // at all) in error.(*googleapi.Error).Header. Use
  1615. // googleapi.IsNotModified to check whether the returned error was
  1616. // because http.StatusNotModified was returned.
  1617. func (c *ProjectsServiceAccountsUpdateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  1618. gensupport.SetOptions(c.urlParams_, opts...)
  1619. res, err := c.doRequest("json")
  1620. if res != nil && res.StatusCode == http.StatusNotModified {
  1621. if res.Body != nil {
  1622. res.Body.Close()
  1623. }
  1624. return nil, &googleapi.Error{
  1625. Code: res.StatusCode,
  1626. Header: res.Header,
  1627. }
  1628. }
  1629. if err != nil {
  1630. return nil, err
  1631. }
  1632. defer googleapi.CloseBody(res)
  1633. if err := googleapi.CheckResponse(res); err != nil {
  1634. return nil, err
  1635. }
  1636. ret := &ServiceAccount{
  1637. ServerResponse: googleapi.ServerResponse{
  1638. Header: res.Header,
  1639. HTTPStatusCode: res.StatusCode,
  1640. },
  1641. }
  1642. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1643. return nil, err
  1644. }
  1645. return ret, nil
  1646. // {
  1647. // "description": "Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory.",
  1648. // "httpMethod": "PUT",
  1649. // "id": "iam.projects.serviceAccounts.update",
  1650. // "parameterOrder": [
  1651. // "name"
  1652. // ],
  1653. // "parameters": {
  1654. // "name": {
  1655. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format \"projects/{project}/serviceAccounts/{email}\".",
  1656. // "location": "path",
  1657. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1658. // "required": true,
  1659. // "type": "string"
  1660. // }
  1661. // },
  1662. // "path": "v1/{+name}",
  1663. // "request": {
  1664. // "$ref": "ServiceAccount"
  1665. // },
  1666. // "response": {
  1667. // "$ref": "ServiceAccount"
  1668. // },
  1669. // "scopes": [
  1670. // "https://www.googleapis.com/auth/cloud-platform"
  1671. // ]
  1672. // }
  1673. }
  1674. // method id "iam.projects.serviceAccounts.keys.create":
  1675. type ProjectsServiceAccountsKeysCreateCall struct {
  1676. s *Service
  1677. name string
  1678. createserviceaccountkeyrequest *CreateServiceAccountKeyRequest
  1679. urlParams_ gensupport.URLParams
  1680. ctx_ context.Context
  1681. }
  1682. // Create: Creates a service account key and returns it.
  1683. func (r *ProjectsServiceAccountsKeysService) Create(name string, createserviceaccountkeyrequest *CreateServiceAccountKeyRequest) *ProjectsServiceAccountsKeysCreateCall {
  1684. c := &ProjectsServiceAccountsKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1685. c.name = name
  1686. c.createserviceaccountkeyrequest = createserviceaccountkeyrequest
  1687. return c
  1688. }
  1689. // Fields allows partial responses to be retrieved. See
  1690. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1691. // for more information.
  1692. func (c *ProjectsServiceAccountsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysCreateCall {
  1693. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1694. return c
  1695. }
  1696. // Context sets the context to be used in this call's Do method. Any
  1697. // pending HTTP request will be aborted if the provided context is
  1698. // canceled.
  1699. func (c *ProjectsServiceAccountsKeysCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysCreateCall {
  1700. c.ctx_ = ctx
  1701. return c
  1702. }
  1703. func (c *ProjectsServiceAccountsKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  1704. var body io.Reader = nil
  1705. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountkeyrequest)
  1706. if err != nil {
  1707. return nil, err
  1708. }
  1709. ctype := "application/json"
  1710. c.urlParams_.Set("alt", alt)
  1711. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  1712. urls += "?" + c.urlParams_.Encode()
  1713. req, _ := http.NewRequest("POST", urls, body)
  1714. googleapi.Expand(req.URL, map[string]string{
  1715. "name": c.name,
  1716. })
  1717. req.Header.Set("Content-Type", ctype)
  1718. req.Header.Set("User-Agent", c.s.userAgent())
  1719. if c.ctx_ != nil {
  1720. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1721. }
  1722. return c.s.client.Do(req)
  1723. }
  1724. // Do executes the "iam.projects.serviceAccounts.keys.create" call.
  1725. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  1726. // non-2xx status code is an error. Response headers are in either
  1727. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  1728. // returned at all) in error.(*googleapi.Error).Header. Use
  1729. // googleapi.IsNotModified to check whether the returned error was
  1730. // because http.StatusNotModified was returned.
  1731. func (c *ProjectsServiceAccountsKeysCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  1732. gensupport.SetOptions(c.urlParams_, opts...)
  1733. res, err := c.doRequest("json")
  1734. if res != nil && res.StatusCode == http.StatusNotModified {
  1735. if res.Body != nil {
  1736. res.Body.Close()
  1737. }
  1738. return nil, &googleapi.Error{
  1739. Code: res.StatusCode,
  1740. Header: res.Header,
  1741. }
  1742. }
  1743. if err != nil {
  1744. return nil, err
  1745. }
  1746. defer googleapi.CloseBody(res)
  1747. if err := googleapi.CheckResponse(res); err != nil {
  1748. return nil, err
  1749. }
  1750. ret := &ServiceAccountKey{
  1751. ServerResponse: googleapi.ServerResponse{
  1752. Header: res.Header,
  1753. HTTPStatusCode: res.StatusCode,
  1754. },
  1755. }
  1756. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1757. return nil, err
  1758. }
  1759. return ret, nil
  1760. // {
  1761. // "description": "Creates a service account key and returns it.",
  1762. // "httpMethod": "POST",
  1763. // "id": "iam.projects.serviceAccounts.keys.create",
  1764. // "parameterOrder": [
  1765. // "name"
  1766. // ],
  1767. // "parameters": {
  1768. // "name": {
  1769. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  1770. // "location": "path",
  1771. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  1772. // "required": true,
  1773. // "type": "string"
  1774. // }
  1775. // },
  1776. // "path": "v1/{+name}/keys",
  1777. // "request": {
  1778. // "$ref": "CreateServiceAccountKeyRequest"
  1779. // },
  1780. // "response": {
  1781. // "$ref": "ServiceAccountKey"
  1782. // },
  1783. // "scopes": [
  1784. // "https://www.googleapis.com/auth/cloud-platform"
  1785. // ]
  1786. // }
  1787. }
  1788. // method id "iam.projects.serviceAccounts.keys.delete":
  1789. type ProjectsServiceAccountsKeysDeleteCall struct {
  1790. s *Service
  1791. name string
  1792. urlParams_ gensupport.URLParams
  1793. ctx_ context.Context
  1794. }
  1795. // Delete: Deletes a service account key.
  1796. func (r *ProjectsServiceAccountsKeysService) Delete(name string) *ProjectsServiceAccountsKeysDeleteCall {
  1797. c := &ProjectsServiceAccountsKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1798. c.name = name
  1799. return c
  1800. }
  1801. // Fields allows partial responses to be retrieved. See
  1802. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1803. // for more information.
  1804. func (c *ProjectsServiceAccountsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysDeleteCall {
  1805. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1806. return c
  1807. }
  1808. // Context sets the context to be used in this call's Do method. Any
  1809. // pending HTTP request will be aborted if the provided context is
  1810. // canceled.
  1811. func (c *ProjectsServiceAccountsKeysDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysDeleteCall {
  1812. c.ctx_ = ctx
  1813. return c
  1814. }
  1815. func (c *ProjectsServiceAccountsKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1816. var body io.Reader = nil
  1817. c.urlParams_.Set("alt", alt)
  1818. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1819. urls += "?" + c.urlParams_.Encode()
  1820. req, _ := http.NewRequest("DELETE", urls, body)
  1821. googleapi.Expand(req.URL, map[string]string{
  1822. "name": c.name,
  1823. })
  1824. req.Header.Set("User-Agent", c.s.userAgent())
  1825. if c.ctx_ != nil {
  1826. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1827. }
  1828. return c.s.client.Do(req)
  1829. }
  1830. // Do executes the "iam.projects.serviceAccounts.keys.delete" call.
  1831. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1832. // code is an error. Response headers are in either
  1833. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1834. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1835. // check whether the returned error was because http.StatusNotModified
  1836. // was returned.
  1837. func (c *ProjectsServiceAccountsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1838. gensupport.SetOptions(c.urlParams_, opts...)
  1839. res, err := c.doRequest("json")
  1840. if res != nil && res.StatusCode == http.StatusNotModified {
  1841. if res.Body != nil {
  1842. res.Body.Close()
  1843. }
  1844. return nil, &googleapi.Error{
  1845. Code: res.StatusCode,
  1846. Header: res.Header,
  1847. }
  1848. }
  1849. if err != nil {
  1850. return nil, err
  1851. }
  1852. defer googleapi.CloseBody(res)
  1853. if err := googleapi.CheckResponse(res); err != nil {
  1854. return nil, err
  1855. }
  1856. ret := &Empty{
  1857. ServerResponse: googleapi.ServerResponse{
  1858. Header: res.Header,
  1859. HTTPStatusCode: res.StatusCode,
  1860. },
  1861. }
  1862. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1863. return nil, err
  1864. }
  1865. return ret, nil
  1866. // {
  1867. // "description": "Deletes a service account key.",
  1868. // "httpMethod": "DELETE",
  1869. // "id": "iam.projects.serviceAccounts.keys.delete",
  1870. // "parameterOrder": [
  1871. // "name"
  1872. // ],
  1873. // "parameters": {
  1874. // "name": {
  1875. // "description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  1876. // "location": "path",
  1877. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$",
  1878. // "required": true,
  1879. // "type": "string"
  1880. // }
  1881. // },
  1882. // "path": "v1/{+name}",
  1883. // "response": {
  1884. // "$ref": "Empty"
  1885. // },
  1886. // "scopes": [
  1887. // "https://www.googleapis.com/auth/cloud-platform"
  1888. // ]
  1889. // }
  1890. }
  1891. // method id "iam.projects.serviceAccounts.keys.get":
  1892. type ProjectsServiceAccountsKeysGetCall struct {
  1893. s *Service
  1894. name string
  1895. urlParams_ gensupport.URLParams
  1896. ifNoneMatch_ string
  1897. ctx_ context.Context
  1898. }
  1899. // Get: Gets the ServiceAccountKey by key id.
  1900. func (r *ProjectsServiceAccountsKeysService) Get(name string) *ProjectsServiceAccountsKeysGetCall {
  1901. c := &ProjectsServiceAccountsKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1902. c.name = name
  1903. return c
  1904. }
  1905. // Fields allows partial responses to be retrieved. See
  1906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1907. // for more information.
  1908. func (c *ProjectsServiceAccountsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysGetCall {
  1909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1910. return c
  1911. }
  1912. // IfNoneMatch sets the optional parameter which makes the operation
  1913. // fail if the object's ETag matches the given value. This is useful for
  1914. // getting updates only after the object has changed since the last
  1915. // request. Use googleapi.IsNotModified to check whether the response
  1916. // error from Do is the result of In-None-Match.
  1917. func (c *ProjectsServiceAccountsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysGetCall {
  1918. c.ifNoneMatch_ = entityTag
  1919. return c
  1920. }
  1921. // Context sets the context to be used in this call's Do method. Any
  1922. // pending HTTP request will be aborted if the provided context is
  1923. // canceled.
  1924. func (c *ProjectsServiceAccountsKeysGetCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysGetCall {
  1925. c.ctx_ = ctx
  1926. return c
  1927. }
  1928. func (c *ProjectsServiceAccountsKeysGetCall) doRequest(alt string) (*http.Response, error) {
  1929. var body io.Reader = nil
  1930. c.urlParams_.Set("alt", alt)
  1931. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1932. urls += "?" + c.urlParams_.Encode()
  1933. req, _ := http.NewRequest("GET", urls, body)
  1934. googleapi.Expand(req.URL, map[string]string{
  1935. "name": c.name,
  1936. })
  1937. req.Header.Set("User-Agent", c.s.userAgent())
  1938. if c.ifNoneMatch_ != "" {
  1939. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1940. }
  1941. if c.ctx_ != nil {
  1942. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1943. }
  1944. return c.s.client.Do(req)
  1945. }
  1946. // Do executes the "iam.projects.serviceAccounts.keys.get" call.
  1947. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  1948. // non-2xx status code is an error. Response headers are in either
  1949. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  1950. // returned at all) in error.(*googleapi.Error).Header. Use
  1951. // googleapi.IsNotModified to check whether the returned error was
  1952. // because http.StatusNotModified was returned.
  1953. func (c *ProjectsServiceAccountsKeysGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  1954. gensupport.SetOptions(c.urlParams_, opts...)
  1955. res, err := c.doRequest("json")
  1956. if res != nil && res.StatusCode == http.StatusNotModified {
  1957. if res.Body != nil {
  1958. res.Body.Close()
  1959. }
  1960. return nil, &googleapi.Error{
  1961. Code: res.StatusCode,
  1962. Header: res.Header,
  1963. }
  1964. }
  1965. if err != nil {
  1966. return nil, err
  1967. }
  1968. defer googleapi.CloseBody(res)
  1969. if err := googleapi.CheckResponse(res); err != nil {
  1970. return nil, err
  1971. }
  1972. ret := &ServiceAccountKey{
  1973. ServerResponse: googleapi.ServerResponse{
  1974. Header: res.Header,
  1975. HTTPStatusCode: res.StatusCode,
  1976. },
  1977. }
  1978. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1979. return nil, err
  1980. }
  1981. return ret, nil
  1982. // {
  1983. // "description": "Gets the ServiceAccountKey by key id.",
  1984. // "httpMethod": "GET",
  1985. // "id": "iam.projects.serviceAccounts.keys.get",
  1986. // "parameterOrder": [
  1987. // "name"
  1988. // ],
  1989. // "parameters": {
  1990. // "name": {
  1991. // "description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  1992. // "location": "path",
  1993. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$",
  1994. // "required": true,
  1995. // "type": "string"
  1996. // }
  1997. // },
  1998. // "path": "v1/{+name}",
  1999. // "response": {
  2000. // "$ref": "ServiceAccountKey"
  2001. // },
  2002. // "scopes": [
  2003. // "https://www.googleapis.com/auth/cloud-platform"
  2004. // ]
  2005. // }
  2006. }
  2007. // method id "iam.projects.serviceAccounts.keys.list":
  2008. type ProjectsServiceAccountsKeysListCall struct {
  2009. s *Service
  2010. name string
  2011. urlParams_ gensupport.URLParams
  2012. ifNoneMatch_ string
  2013. ctx_ context.Context
  2014. }
  2015. // List: Lists service account keys
  2016. func (r *ProjectsServiceAccountsKeysService) List(name string) *ProjectsServiceAccountsKeysListCall {
  2017. c := &ProjectsServiceAccountsKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2018. c.name = name
  2019. return c
  2020. }
  2021. // KeyTypes sets the optional parameter "keyTypes": The type of keys the
  2022. // user wants to list. If empty, all key types are included in the
  2023. // response. Duplicate key types are not allowed.
  2024. //
  2025. // Possible values:
  2026. // "KEY_TYPE_UNSPECIFIED"
  2027. // "USER_MANAGED"
  2028. // "SYSTEM_MANAGED"
  2029. func (c *ProjectsServiceAccountsKeysListCall) KeyTypes(keyTypes ...string) *ProjectsServiceAccountsKeysListCall {
  2030. c.urlParams_.SetMulti("keyTypes", append([]string{}, keyTypes...))
  2031. return c
  2032. }
  2033. // Fields allows partial responses to be retrieved. See
  2034. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2035. // for more information.
  2036. func (c *ProjectsServiceAccountsKeysListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysListCall {
  2037. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2038. return c
  2039. }
  2040. // IfNoneMatch sets the optional parameter which makes the operation
  2041. // fail if the object's ETag matches the given value. This is useful for
  2042. // getting updates only after the object has changed since the last
  2043. // request. Use googleapi.IsNotModified to check whether the response
  2044. // error from Do is the result of In-None-Match.
  2045. func (c *ProjectsServiceAccountsKeysListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysListCall {
  2046. c.ifNoneMatch_ = entityTag
  2047. return c
  2048. }
  2049. // Context sets the context to be used in this call's Do method. Any
  2050. // pending HTTP request will be aborted if the provided context is
  2051. // canceled.
  2052. func (c *ProjectsServiceAccountsKeysListCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysListCall {
  2053. c.ctx_ = ctx
  2054. return c
  2055. }
  2056. func (c *ProjectsServiceAccountsKeysListCall) doRequest(alt string) (*http.Response, error) {
  2057. var body io.Reader = nil
  2058. c.urlParams_.Set("alt", alt)
  2059. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  2060. urls += "?" + c.urlParams_.Encode()
  2061. req, _ := http.NewRequest("GET", urls, body)
  2062. googleapi.Expand(req.URL, map[string]string{
  2063. "name": c.name,
  2064. })
  2065. req.Header.Set("User-Agent", c.s.userAgent())
  2066. if c.ifNoneMatch_ != "" {
  2067. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2068. }
  2069. if c.ctx_ != nil {
  2070. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2071. }
  2072. return c.s.client.Do(req)
  2073. }
  2074. // Do executes the "iam.projects.serviceAccounts.keys.list" call.
  2075. // Exactly one of *ListServiceAccountKeysResponse or error will be
  2076. // non-nil. Any non-2xx status code is an error. Response headers are in
  2077. // either *ListServiceAccountKeysResponse.ServerResponse.Header or (if a
  2078. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2079. // googleapi.IsNotModified to check whether the returned error was
  2080. // because http.StatusNotModified was returned.
  2081. func (c *ProjectsServiceAccountsKeysListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountKeysResponse, error) {
  2082. gensupport.SetOptions(c.urlParams_, opts...)
  2083. res, err := c.doRequest("json")
  2084. if res != nil && res.StatusCode == http.StatusNotModified {
  2085. if res.Body != nil {
  2086. res.Body.Close()
  2087. }
  2088. return nil, &googleapi.Error{
  2089. Code: res.StatusCode,
  2090. Header: res.Header,
  2091. }
  2092. }
  2093. if err != nil {
  2094. return nil, err
  2095. }
  2096. defer googleapi.CloseBody(res)
  2097. if err := googleapi.CheckResponse(res); err != nil {
  2098. return nil, err
  2099. }
  2100. ret := &ListServiceAccountKeysResponse{
  2101. ServerResponse: googleapi.ServerResponse{
  2102. Header: res.Header,
  2103. HTTPStatusCode: res.StatusCode,
  2104. },
  2105. }
  2106. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2107. return nil, err
  2108. }
  2109. return ret, nil
  2110. // {
  2111. // "description": "Lists service account keys",
  2112. // "httpMethod": "GET",
  2113. // "id": "iam.projects.serviceAccounts.keys.list",
  2114. // "parameterOrder": [
  2115. // "name"
  2116. // ],
  2117. // "parameters": {
  2118. // "keyTypes": {
  2119. // "description": "The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed.",
  2120. // "enum": [
  2121. // "KEY_TYPE_UNSPECIFIED",
  2122. // "USER_MANAGED",
  2123. // "SYSTEM_MANAGED"
  2124. // ],
  2125. // "location": "query",
  2126. // "repeated": true,
  2127. // "type": "string"
  2128. // },
  2129. // "name": {
  2130. // "description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
  2131. // "location": "path",
  2132. // "pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
  2133. // "required": true,
  2134. // "type": "string"
  2135. // }
  2136. // },
  2137. // "path": "v1/{+name}/keys",
  2138. // "response": {
  2139. // "$ref": "ListServiceAccountKeysResponse"
  2140. // },
  2141. // "scopes": [
  2142. // "https://www.googleapis.com/auth/cloud-platform"
  2143. // ]
  2144. // }
  2145. }