googlecloudresourcemanager.pp 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  1. unit googlecloudresourcemanager;
  2. {$MODE objfpc}
  3. {$H+}
  4. interface
  5. uses sysutils, classes, googleservice, restbase, googlebase;
  6. type
  7. //Top-level schema types
  8. TProject = Class;
  9. TResourceId = Class;
  10. TListProjectsResponse = Class;
  11. TEmpty = Class;
  12. TUndeleteProjectRequest = Class;
  13. TGetIamPolicyRequest = Class;
  14. TPolicy = Class;
  15. TBinding = Class;
  16. TSetIamPolicyRequest = Class;
  17. TTestIamPermissionsRequest = Class;
  18. TTestIamPermissionsResponse = Class;
  19. TProjectArray = Array of TProject;
  20. TResourceIdArray = Array of TResourceId;
  21. TListProjectsResponseArray = Array of TListProjectsResponse;
  22. TEmptyArray = Array of TEmpty;
  23. TUndeleteProjectRequestArray = Array of TUndeleteProjectRequest;
  24. TGetIamPolicyRequestArray = Array of TGetIamPolicyRequest;
  25. TPolicyArray = Array of TPolicy;
  26. TBindingArray = Array of TBinding;
  27. TSetIamPolicyRequestArray = Array of TSetIamPolicyRequest;
  28. TTestIamPermissionsRequestArray = Array of TTestIamPermissionsRequest;
  29. TTestIamPermissionsResponseArray = Array of TTestIamPermissionsResponse;
  30. //Anonymous types, using auto-generated names
  31. TProjectTypelabels = Class;
  32. TListProjectsResponseTypeprojectsArray = Array of TProject;
  33. TPolicyTypebindingsArray = Array of TBinding;
  34. { --------------------------------------------------------------------
  35. TProjectTypelabels
  36. --------------------------------------------------------------------}
  37. TProjectTypelabels = Class(TGoogleBaseObject)
  38. Private
  39. Protected
  40. //Property setters
  41. Public
  42. Class Function AllowAdditionalProperties : Boolean; override;
  43. Published
  44. end;
  45. TProjectTypelabelsClass = Class of TProjectTypelabels;
  46. { --------------------------------------------------------------------
  47. TProject
  48. --------------------------------------------------------------------}
  49. TProject = Class(TGoogleBaseObject)
  50. Private
  51. FprojectNumber : String;
  52. FprojectId : String;
  53. FlifecycleState : String;
  54. Fname : String;
  55. FcreateTime : String;
  56. Flabels : TProjectTypelabels;
  57. Fparent : TResourceId;
  58. Protected
  59. //Property setters
  60. Procedure SetprojectNumber(AIndex : Integer; const AValue : String); virtual;
  61. Procedure SetprojectId(AIndex : Integer; const AValue : String); virtual;
  62. Procedure SetlifecycleState(AIndex : Integer; const AValue : String); virtual;
  63. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  64. Procedure SetcreateTime(AIndex : Integer; const AValue : String); virtual;
  65. Procedure Setlabels(AIndex : Integer; const AValue : TProjectTypelabels); virtual;
  66. Procedure Setparent(AIndex : Integer; const AValue : TResourceId); virtual;
  67. Public
  68. Published
  69. Property projectNumber : String Index 0 Read FprojectNumber Write SetprojectNumber;
  70. Property projectId : String Index 8 Read FprojectId Write SetprojectId;
  71. Property lifecycleState : String Index 16 Read FlifecycleState Write SetlifecycleState;
  72. Property name : String Index 24 Read Fname Write Setname;
  73. Property createTime : String Index 32 Read FcreateTime Write SetcreateTime;
  74. Property labels : TProjectTypelabels Index 40 Read Flabels Write Setlabels;
  75. Property parent : TResourceId Index 48 Read Fparent Write Setparent;
  76. end;
  77. TProjectClass = Class of TProject;
  78. { --------------------------------------------------------------------
  79. TResourceId
  80. --------------------------------------------------------------------}
  81. TResourceId = Class(TGoogleBaseObject)
  82. Private
  83. F_type : String;
  84. Fid : String;
  85. Protected
  86. Class Function ExportPropertyName(Const AName : String) : string; override;
  87. //Property setters
  88. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  89. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  90. Public
  91. Published
  92. Property _type : String Index 0 Read F_type Write Set_type;
  93. Property id : String Index 8 Read Fid Write Setid;
  94. end;
  95. TResourceIdClass = Class of TResourceId;
  96. { --------------------------------------------------------------------
  97. TListProjectsResponse
  98. --------------------------------------------------------------------}
  99. TListProjectsResponse = Class(TGoogleBaseObject)
  100. Private
  101. Fprojects : TListProjectsResponseTypeprojectsArray;
  102. FnextPageToken : String;
  103. Protected
  104. //Property setters
  105. Procedure Setprojects(AIndex : Integer; const AValue : TListProjectsResponseTypeprojectsArray); virtual;
  106. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  107. //2.6.4. bug workaround
  108. {$IFDEF VER2_6}
  109. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  110. {$ENDIF VER2_6}
  111. Public
  112. Published
  113. Property projects : TListProjectsResponseTypeprojectsArray Index 0 Read Fprojects Write Setprojects;
  114. Property nextPageToken : String Index 8 Read FnextPageToken Write SetnextPageToken;
  115. end;
  116. TListProjectsResponseClass = Class of TListProjectsResponse;
  117. { --------------------------------------------------------------------
  118. TEmpty
  119. --------------------------------------------------------------------}
  120. TEmpty = Class(TGoogleBaseObject)
  121. Private
  122. Protected
  123. //Property setters
  124. Public
  125. Published
  126. end;
  127. TEmptyClass = Class of TEmpty;
  128. { --------------------------------------------------------------------
  129. TUndeleteProjectRequest
  130. --------------------------------------------------------------------}
  131. TUndeleteProjectRequest = Class(TGoogleBaseObject)
  132. Private
  133. Protected
  134. //Property setters
  135. Public
  136. Published
  137. end;
  138. TUndeleteProjectRequestClass = Class of TUndeleteProjectRequest;
  139. { --------------------------------------------------------------------
  140. TGetIamPolicyRequest
  141. --------------------------------------------------------------------}
  142. TGetIamPolicyRequest = Class(TGoogleBaseObject)
  143. Private
  144. Protected
  145. //Property setters
  146. Public
  147. Published
  148. end;
  149. TGetIamPolicyRequestClass = Class of TGetIamPolicyRequest;
  150. { --------------------------------------------------------------------
  151. TPolicy
  152. --------------------------------------------------------------------}
  153. TPolicy = Class(TGoogleBaseObject)
  154. Private
  155. Fversion : integer;
  156. Fbindings : TPolicyTypebindingsArray;
  157. Fetag : String;
  158. Protected
  159. //Property setters
  160. Procedure Setversion(AIndex : Integer; const AValue : integer); virtual;
  161. Procedure Setbindings(AIndex : Integer; const AValue : TPolicyTypebindingsArray); virtual;
  162. Procedure Setetag(AIndex : Integer; const AValue : String); virtual;
  163. //2.6.4. bug workaround
  164. {$IFDEF VER2_6}
  165. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  166. {$ENDIF VER2_6}
  167. Public
  168. Published
  169. Property version : integer Index 0 Read Fversion Write Setversion;
  170. Property bindings : TPolicyTypebindingsArray Index 8 Read Fbindings Write Setbindings;
  171. Property etag : String Index 16 Read Fetag Write Setetag;
  172. end;
  173. TPolicyClass = Class of TPolicy;
  174. { --------------------------------------------------------------------
  175. TBinding
  176. --------------------------------------------------------------------}
  177. TBinding = Class(TGoogleBaseObject)
  178. Private
  179. Frole : String;
  180. Fmembers : TStringArray;
  181. Protected
  182. //Property setters
  183. Procedure Setrole(AIndex : Integer; const AValue : String); virtual;
  184. Procedure Setmembers(AIndex : Integer; const AValue : TStringArray); virtual;
  185. //2.6.4. bug workaround
  186. {$IFDEF VER2_6}
  187. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  188. {$ENDIF VER2_6}
  189. Public
  190. Published
  191. Property role : String Index 0 Read Frole Write Setrole;
  192. Property members : TStringArray Index 8 Read Fmembers Write Setmembers;
  193. end;
  194. TBindingClass = Class of TBinding;
  195. { --------------------------------------------------------------------
  196. TSetIamPolicyRequest
  197. --------------------------------------------------------------------}
  198. TSetIamPolicyRequest = Class(TGoogleBaseObject)
  199. Private
  200. Fpolicy : TPolicy;
  201. Protected
  202. //Property setters
  203. Procedure Setpolicy(AIndex : Integer; const AValue : TPolicy); virtual;
  204. Public
  205. Published
  206. Property policy : TPolicy Index 0 Read Fpolicy Write Setpolicy;
  207. end;
  208. TSetIamPolicyRequestClass = Class of TSetIamPolicyRequest;
  209. { --------------------------------------------------------------------
  210. TTestIamPermissionsRequest
  211. --------------------------------------------------------------------}
  212. TTestIamPermissionsRequest = Class(TGoogleBaseObject)
  213. Private
  214. Fpermissions : TStringArray;
  215. Protected
  216. //Property setters
  217. Procedure Setpermissions(AIndex : Integer; const AValue : TStringArray); virtual;
  218. //2.6.4. bug workaround
  219. {$IFDEF VER2_6}
  220. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  221. {$ENDIF VER2_6}
  222. Public
  223. Published
  224. Property permissions : TStringArray Index 0 Read Fpermissions Write Setpermissions;
  225. end;
  226. TTestIamPermissionsRequestClass = Class of TTestIamPermissionsRequest;
  227. { --------------------------------------------------------------------
  228. TTestIamPermissionsResponse
  229. --------------------------------------------------------------------}
  230. TTestIamPermissionsResponse = Class(TGoogleBaseObject)
  231. Private
  232. Fpermissions : TStringArray;
  233. Protected
  234. //Property setters
  235. Procedure Setpermissions(AIndex : Integer; const AValue : TStringArray); virtual;
  236. //2.6.4. bug workaround
  237. {$IFDEF VER2_6}
  238. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  239. {$ENDIF VER2_6}
  240. Public
  241. Published
  242. Property permissions : TStringArray Index 0 Read Fpermissions Write Setpermissions;
  243. end;
  244. TTestIamPermissionsResponseClass = Class of TTestIamPermissionsResponse;
  245. { --------------------------------------------------------------------
  246. TProjectsResource
  247. --------------------------------------------------------------------}
  248. //Optional query Options for TProjectsResource, method List
  249. TProjectsListOptions = Record
  250. pageToken : String;
  251. pageSize : integer;
  252. filter : String;
  253. end;
  254. TProjectsResource = Class(TGoogleResource)
  255. Public
  256. Class Function ResourceName : String; override;
  257. Class Function DefaultAPI : TGoogleAPIClass; override;
  258. Function Get(projectId: string) : TProject;
  259. Function List(AQuery : string = '') : TListProjectsResponse;
  260. Function List(AQuery : TProjectslistOptions) : TListProjectsResponse;
  261. Function Update(projectId: string; aProject : TProject) : TProject;
  262. Function Delete(projectId: string) : TEmpty;
  263. Function Undelete(projectId: string; aUndeleteProjectRequest : TUndeleteProjectRequest) : TEmpty;
  264. Function GetIamPolicy(resource: string; aGetIamPolicyRequest : TGetIamPolicyRequest) : TPolicy;
  265. Function SetIamPolicy(resource: string; aSetIamPolicyRequest : TSetIamPolicyRequest) : TPolicy;
  266. Function TestIamPermissions(resource: string; aTestIamPermissionsRequest : TTestIamPermissionsRequest) : TTestIamPermissionsResponse;
  267. end;
  268. { --------------------------------------------------------------------
  269. TCloudresourcemanagerAPI
  270. --------------------------------------------------------------------}
  271. TCloudresourcemanagerAPI = Class(TGoogleAPI)
  272. Private
  273. FProjectsInstance : TProjectsResource;
  274. Function GetProjectsInstance : TProjectsResource;virtual;
  275. Public
  276. //Override class functions with API info
  277. Class Function APIName : String; override;
  278. Class Function APIVersion : String; override;
  279. Class Function APIRevision : String; override;
  280. Class Function APIID : String; override;
  281. Class Function APITitle : String; override;
  282. Class Function APIDescription : String; override;
  283. Class Function APIOwnerDomain : String; override;
  284. Class Function APIOwnerName : String; override;
  285. Class Function APIIcon16 : String; override;
  286. Class Function APIIcon32 : String; override;
  287. Class Function APIdocumentationLink : String; override;
  288. Class Function APIrootUrl : string; override;
  289. Class Function APIbasePath : string;override;
  290. Class Function APIbaseURL : String;override;
  291. Class Function APIProtocol : string;override;
  292. Class Function APIservicePath : string;override;
  293. Class Function APIbatchPath : String;override;
  294. Class Function APIAuthScopes : TScopeInfoArray;override;
  295. Class Function APINeedsAuth : Boolean;override;
  296. Class Procedure RegisterAPIResources; override;
  297. //Add create function for resources
  298. Function CreateProjectsResource(AOwner : TComponent) : TProjectsResource;virtual;overload;
  299. Function CreateProjectsResource : TProjectsResource;virtual;overload;
  300. //Add default on-demand instances for resources
  301. Property ProjectsResource : TProjectsResource Read GetProjectsInstance;
  302. end;
  303. implementation
  304. { --------------------------------------------------------------------
  305. TProjectTypelabels
  306. --------------------------------------------------------------------}
  307. Class Function TProjectTypelabels.AllowAdditionalProperties : Boolean;
  308. begin
  309. Result:=True;
  310. end;
  311. { --------------------------------------------------------------------
  312. TProject
  313. --------------------------------------------------------------------}
  314. Procedure TProject.SetprojectNumber(AIndex : Integer; const AValue : String);
  315. begin
  316. If (FprojectNumber=AValue) then exit;
  317. FprojectNumber:=AValue;
  318. MarkPropertyChanged(AIndex);
  319. end;
  320. Procedure TProject.SetprojectId(AIndex : Integer; const AValue : String);
  321. begin
  322. If (FprojectId=AValue) then exit;
  323. FprojectId:=AValue;
  324. MarkPropertyChanged(AIndex);
  325. end;
  326. Procedure TProject.SetlifecycleState(AIndex : Integer; const AValue : String);
  327. begin
  328. If (FlifecycleState=AValue) then exit;
  329. FlifecycleState:=AValue;
  330. MarkPropertyChanged(AIndex);
  331. end;
  332. Procedure TProject.Setname(AIndex : Integer; const AValue : String);
  333. begin
  334. If (Fname=AValue) then exit;
  335. Fname:=AValue;
  336. MarkPropertyChanged(AIndex);
  337. end;
  338. Procedure TProject.SetcreateTime(AIndex : Integer; const AValue : String);
  339. begin
  340. If (FcreateTime=AValue) then exit;
  341. FcreateTime:=AValue;
  342. MarkPropertyChanged(AIndex);
  343. end;
  344. Procedure TProject.Setlabels(AIndex : Integer; const AValue : TProjectTypelabels);
  345. begin
  346. If (Flabels=AValue) then exit;
  347. Flabels:=AValue;
  348. MarkPropertyChanged(AIndex);
  349. end;
  350. Procedure TProject.Setparent(AIndex : Integer; const AValue : TResourceId);
  351. begin
  352. If (Fparent=AValue) then exit;
  353. Fparent:=AValue;
  354. MarkPropertyChanged(AIndex);
  355. end;
  356. { --------------------------------------------------------------------
  357. TResourceId
  358. --------------------------------------------------------------------}
  359. Procedure TResourceId.Set_type(AIndex : Integer; const AValue : String);
  360. begin
  361. If (F_type=AValue) then exit;
  362. F_type:=AValue;
  363. MarkPropertyChanged(AIndex);
  364. end;
  365. Procedure TResourceId.Setid(AIndex : Integer; const AValue : String);
  366. begin
  367. If (Fid=AValue) then exit;
  368. Fid:=AValue;
  369. MarkPropertyChanged(AIndex);
  370. end;
  371. Class Function TResourceId.ExportPropertyName(Const AName : String) :String;
  372. begin
  373. Case AName of
  374. '_type' : Result:='type';
  375. else
  376. Result:=Inherited ExportPropertyName(AName);
  377. end;
  378. end;
  379. { --------------------------------------------------------------------
  380. TListProjectsResponse
  381. --------------------------------------------------------------------}
  382. Procedure TListProjectsResponse.Setprojects(AIndex : Integer; const AValue : TListProjectsResponseTypeprojectsArray);
  383. begin
  384. If (Fprojects=AValue) then exit;
  385. Fprojects:=AValue;
  386. MarkPropertyChanged(AIndex);
  387. end;
  388. Procedure TListProjectsResponse.SetnextPageToken(AIndex : Integer; const AValue : String);
  389. begin
  390. If (FnextPageToken=AValue) then exit;
  391. FnextPageToken:=AValue;
  392. MarkPropertyChanged(AIndex);
  393. end;
  394. //2.6.4. bug workaround
  395. {$IFDEF VER2_6}
  396. Procedure TListProjectsResponse.SetArrayLength(Const AName : String; ALength : Longint);
  397. begin
  398. Case AName of
  399. 'projects' : SetLength(Fprojects,ALength);
  400. else
  401. Inherited SetArrayLength(AName,ALength);
  402. end;
  403. end;
  404. {$ENDIF VER2_6}
  405. { --------------------------------------------------------------------
  406. TEmpty
  407. --------------------------------------------------------------------}
  408. { --------------------------------------------------------------------
  409. TUndeleteProjectRequest
  410. --------------------------------------------------------------------}
  411. { --------------------------------------------------------------------
  412. TGetIamPolicyRequest
  413. --------------------------------------------------------------------}
  414. { --------------------------------------------------------------------
  415. TPolicy
  416. --------------------------------------------------------------------}
  417. Procedure TPolicy.Setversion(AIndex : Integer; const AValue : integer);
  418. begin
  419. If (Fversion=AValue) then exit;
  420. Fversion:=AValue;
  421. MarkPropertyChanged(AIndex);
  422. end;
  423. Procedure TPolicy.Setbindings(AIndex : Integer; const AValue : TPolicyTypebindingsArray);
  424. begin
  425. If (Fbindings=AValue) then exit;
  426. Fbindings:=AValue;
  427. MarkPropertyChanged(AIndex);
  428. end;
  429. Procedure TPolicy.Setetag(AIndex : Integer; const AValue : String);
  430. begin
  431. If (Fetag=AValue) then exit;
  432. Fetag:=AValue;
  433. MarkPropertyChanged(AIndex);
  434. end;
  435. //2.6.4. bug workaround
  436. {$IFDEF VER2_6}
  437. Procedure TPolicy.SetArrayLength(Const AName : String; ALength : Longint);
  438. begin
  439. Case AName of
  440. 'bindings' : SetLength(Fbindings,ALength);
  441. else
  442. Inherited SetArrayLength(AName,ALength);
  443. end;
  444. end;
  445. {$ENDIF VER2_6}
  446. { --------------------------------------------------------------------
  447. TBinding
  448. --------------------------------------------------------------------}
  449. Procedure TBinding.Setrole(AIndex : Integer; const AValue : String);
  450. begin
  451. If (Frole=AValue) then exit;
  452. Frole:=AValue;
  453. MarkPropertyChanged(AIndex);
  454. end;
  455. Procedure TBinding.Setmembers(AIndex : Integer; const AValue : TStringArray);
  456. begin
  457. If (Fmembers=AValue) then exit;
  458. Fmembers:=AValue;
  459. MarkPropertyChanged(AIndex);
  460. end;
  461. //2.6.4. bug workaround
  462. {$IFDEF VER2_6}
  463. Procedure TBinding.SetArrayLength(Const AName : String; ALength : Longint);
  464. begin
  465. Case AName of
  466. 'members' : SetLength(Fmembers,ALength);
  467. else
  468. Inherited SetArrayLength(AName,ALength);
  469. end;
  470. end;
  471. {$ENDIF VER2_6}
  472. { --------------------------------------------------------------------
  473. TSetIamPolicyRequest
  474. --------------------------------------------------------------------}
  475. Procedure TSetIamPolicyRequest.Setpolicy(AIndex : Integer; const AValue : TPolicy);
  476. begin
  477. If (Fpolicy=AValue) then exit;
  478. Fpolicy:=AValue;
  479. MarkPropertyChanged(AIndex);
  480. end;
  481. { --------------------------------------------------------------------
  482. TTestIamPermissionsRequest
  483. --------------------------------------------------------------------}
  484. Procedure TTestIamPermissionsRequest.Setpermissions(AIndex : Integer; const AValue : TStringArray);
  485. begin
  486. If (Fpermissions=AValue) then exit;
  487. Fpermissions:=AValue;
  488. MarkPropertyChanged(AIndex);
  489. end;
  490. //2.6.4. bug workaround
  491. {$IFDEF VER2_6}
  492. Procedure TTestIamPermissionsRequest.SetArrayLength(Const AName : String; ALength : Longint);
  493. begin
  494. Case AName of
  495. 'permissions' : SetLength(Fpermissions,ALength);
  496. else
  497. Inherited SetArrayLength(AName,ALength);
  498. end;
  499. end;
  500. {$ENDIF VER2_6}
  501. { --------------------------------------------------------------------
  502. TTestIamPermissionsResponse
  503. --------------------------------------------------------------------}
  504. Procedure TTestIamPermissionsResponse.Setpermissions(AIndex : Integer; const AValue : TStringArray);
  505. begin
  506. If (Fpermissions=AValue) then exit;
  507. Fpermissions:=AValue;
  508. MarkPropertyChanged(AIndex);
  509. end;
  510. //2.6.4. bug workaround
  511. {$IFDEF VER2_6}
  512. Procedure TTestIamPermissionsResponse.SetArrayLength(Const AName : String; ALength : Longint);
  513. begin
  514. Case AName of
  515. 'permissions' : SetLength(Fpermissions,ALength);
  516. else
  517. Inherited SetArrayLength(AName,ALength);
  518. end;
  519. end;
  520. {$ENDIF VER2_6}
  521. { --------------------------------------------------------------------
  522. TProjectsResource
  523. --------------------------------------------------------------------}
  524. Class Function TProjectsResource.ResourceName : String;
  525. begin
  526. Result:='projects';
  527. end;
  528. Class Function TProjectsResource.DefaultAPI : TGoogleAPIClass;
  529. begin
  530. Result:=TcloudresourcemanagerAPI;
  531. end;
  532. Function TProjectsResource.Get(projectId: string) : TProject;
  533. Const
  534. _HTTPMethod = 'GET';
  535. _Path = 'v1/projects/{projectId}';
  536. _Methodid = 'cloudresourcemanager.projects.get';
  537. Var
  538. _P : String;
  539. begin
  540. _P:=SubstitutePath(_Path,['projectId',projectId]);
  541. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TProject) as TProject;
  542. end;
  543. Function TProjectsResource.List(AQuery : string = '') : TListProjectsResponse;
  544. Const
  545. _HTTPMethod = 'GET';
  546. _Path = 'v1/projects';
  547. _Methodid = 'cloudresourcemanager.projects.list';
  548. begin
  549. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TListProjectsResponse) as TListProjectsResponse;
  550. end;
  551. Function TProjectsResource.List(AQuery : TProjectslistOptions) : TListProjectsResponse;
  552. Var
  553. _Q : String;
  554. begin
  555. _Q:='';
  556. AddToQuery(_Q,'pageToken',AQuery.pageToken);
  557. AddToQuery(_Q,'pageSize',AQuery.pageSize);
  558. AddToQuery(_Q,'filter',AQuery.filter);
  559. Result:=List(_Q);
  560. end;
  561. Function TProjectsResource.Update(projectId: string; aProject : TProject) : TProject;
  562. Const
  563. _HTTPMethod = 'PUT';
  564. _Path = 'v1/projects/{projectId}';
  565. _Methodid = 'cloudresourcemanager.projects.update';
  566. Var
  567. _P : String;
  568. begin
  569. _P:=SubstitutePath(_Path,['projectId',projectId]);
  570. Result:=ServiceCall(_HTTPMethod,_P,'',aProject,TProject) as TProject;
  571. end;
  572. Function TProjectsResource.Delete(projectId: string) : TEmpty;
  573. Const
  574. _HTTPMethod = 'DELETE';
  575. _Path = 'v1/projects/{projectId}';
  576. _Methodid = 'cloudresourcemanager.projects.delete';
  577. Var
  578. _P : String;
  579. begin
  580. _P:=SubstitutePath(_Path,['projectId',projectId]);
  581. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TEmpty) as TEmpty;
  582. end;
  583. Function TProjectsResource.Undelete(projectId: string; aUndeleteProjectRequest : TUndeleteProjectRequest) : TEmpty;
  584. Const
  585. _HTTPMethod = 'POST';
  586. _Path = 'v1/projects/{projectId}:undelete';
  587. _Methodid = 'cloudresourcemanager.projects.undelete';
  588. Var
  589. _P : String;
  590. begin
  591. _P:=SubstitutePath(_Path,['projectId',projectId]);
  592. Result:=ServiceCall(_HTTPMethod,_P,'',aUndeleteProjectRequest,TEmpty) as TEmpty;
  593. end;
  594. Function TProjectsResource.GetIamPolicy(resource: string; aGetIamPolicyRequest : TGetIamPolicyRequest) : TPolicy;
  595. Const
  596. _HTTPMethod = 'POST';
  597. _Path = 'v1/projects/{resource}:getIamPolicy';
  598. _Methodid = 'cloudresourcemanager.projects.getIamPolicy';
  599. Var
  600. _P : String;
  601. begin
  602. _P:=SubstitutePath(_Path,['resource',resource]);
  603. Result:=ServiceCall(_HTTPMethod,_P,'',aGetIamPolicyRequest,TPolicy) as TPolicy;
  604. end;
  605. Function TProjectsResource.SetIamPolicy(resource: string; aSetIamPolicyRequest : TSetIamPolicyRequest) : TPolicy;
  606. Const
  607. _HTTPMethod = 'POST';
  608. _Path = 'v1/projects/{resource}:setIamPolicy';
  609. _Methodid = 'cloudresourcemanager.projects.setIamPolicy';
  610. Var
  611. _P : String;
  612. begin
  613. _P:=SubstitutePath(_Path,['resource',resource]);
  614. Result:=ServiceCall(_HTTPMethod,_P,'',aSetIamPolicyRequest,TPolicy) as TPolicy;
  615. end;
  616. Function TProjectsResource.TestIamPermissions(resource: string; aTestIamPermissionsRequest : TTestIamPermissionsRequest) : TTestIamPermissionsResponse;
  617. Const
  618. _HTTPMethod = 'POST';
  619. _Path = 'v1/projects/{resource}:testIamPermissions';
  620. _Methodid = 'cloudresourcemanager.projects.testIamPermissions';
  621. Var
  622. _P : String;
  623. begin
  624. _P:=SubstitutePath(_Path,['resource',resource]);
  625. Result:=ServiceCall(_HTTPMethod,_P,'',aTestIamPermissionsRequest,TTestIamPermissionsResponse) as TTestIamPermissionsResponse;
  626. end;
  627. { --------------------------------------------------------------------
  628. TCloudresourcemanagerAPI
  629. --------------------------------------------------------------------}
  630. Class Function TCloudresourcemanagerAPI.APIName : String;
  631. begin
  632. Result:='cloudresourcemanager';
  633. end;
  634. Class Function TCloudresourcemanagerAPI.APIVersion : String;
  635. begin
  636. Result:='v1';
  637. end;
  638. Class Function TCloudresourcemanagerAPI.APIRevision : String;
  639. begin
  640. Result:='20160518';
  641. end;
  642. Class Function TCloudresourcemanagerAPI.APIID : String;
  643. begin
  644. Result:='cloudresourcemanager:v1';
  645. end;
  646. Class Function TCloudresourcemanagerAPI.APITitle : String;
  647. begin
  648. Result:='Google Cloud Resource Manager API';
  649. end;
  650. Class Function TCloudresourcemanagerAPI.APIDescription : String;
  651. begin
  652. Result:='The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.';
  653. end;
  654. Class Function TCloudresourcemanagerAPI.APIOwnerDomain : String;
  655. begin
  656. Result:='google.com';
  657. end;
  658. Class Function TCloudresourcemanagerAPI.APIOwnerName : String;
  659. begin
  660. Result:='Google';
  661. end;
  662. Class Function TCloudresourcemanagerAPI.APIIcon16 : String;
  663. begin
  664. Result:='http://www.google.com/images/icons/product/search-16.gif';
  665. end;
  666. Class Function TCloudresourcemanagerAPI.APIIcon32 : String;
  667. begin
  668. Result:='http://www.google.com/images/icons/product/search-32.gif';
  669. end;
  670. Class Function TCloudresourcemanagerAPI.APIdocumentationLink : String;
  671. begin
  672. Result:='https://cloud.google.com/resource-manager';
  673. end;
  674. Class Function TCloudresourcemanagerAPI.APIrootUrl : string;
  675. begin
  676. Result:='https://cloudresourcemanager.googleapis.com/';
  677. end;
  678. Class Function TCloudresourcemanagerAPI.APIbasePath : string;
  679. begin
  680. Result:='';
  681. end;
  682. Class Function TCloudresourcemanagerAPI.APIbaseURL : String;
  683. begin
  684. Result:='https://cloudresourcemanager.googleapis.com/';
  685. end;
  686. Class Function TCloudresourcemanagerAPI.APIProtocol : string;
  687. begin
  688. Result:='rest';
  689. end;
  690. Class Function TCloudresourcemanagerAPI.APIservicePath : string;
  691. begin
  692. Result:='';
  693. end;
  694. Class Function TCloudresourcemanagerAPI.APIbatchPath : String;
  695. begin
  696. Result:='batch';
  697. end;
  698. Class Function TCloudresourcemanagerAPI.APIAuthScopes : TScopeInfoArray;
  699. begin
  700. SetLength(Result,2);
  701. Result[0].Name:='https://www.googleapis.com/auth/cloud-platform';
  702. Result[0].Description:='View and manage your data across Google Cloud Platform services';
  703. Result[1].Name:='https://www.googleapis.com/auth/cloud-platform.read-only';
  704. Result[1].Description:='View your data across Google Cloud Platform services';
  705. end;
  706. Class Function TCloudresourcemanagerAPI.APINeedsAuth : Boolean;
  707. begin
  708. Result:=True;
  709. end;
  710. Class Procedure TCloudresourcemanagerAPI.RegisterAPIResources;
  711. begin
  712. TProjectTypelabels.RegisterObject;
  713. TProject.RegisterObject;
  714. TResourceId.RegisterObject;
  715. TListProjectsResponse.RegisterObject;
  716. TEmpty.RegisterObject;
  717. TUndeleteProjectRequest.RegisterObject;
  718. TGetIamPolicyRequest.RegisterObject;
  719. TPolicy.RegisterObject;
  720. TBinding.RegisterObject;
  721. TSetIamPolicyRequest.RegisterObject;
  722. TTestIamPermissionsRequest.RegisterObject;
  723. TTestIamPermissionsResponse.RegisterObject;
  724. end;
  725. Function TCloudresourcemanagerAPI.GetProjectsInstance : TProjectsResource;
  726. begin
  727. if (FProjectsInstance=Nil) then
  728. FProjectsInstance:=CreateProjectsResource;
  729. Result:=FProjectsInstance;
  730. end;
  731. Function TCloudresourcemanagerAPI.CreateProjectsResource : TProjectsResource;
  732. begin
  733. Result:=CreateProjectsResource(Self);
  734. end;
  735. Function TCloudresourcemanagerAPI.CreateProjectsResource(AOwner : TComponent) : TProjectsResource;
  736. begin
  737. Result:=TProjectsResource.Create(AOwner);
  738. Result.API:=Self.API;
  739. end;
  740. initialization
  741. TCloudresourcemanagerAPI.RegisterAPI;
  742. end.