@naturali/sdk 0.232.1 → 0.233.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5296,6 +5296,72 @@ var Playbooks = class {
5296
5296
  });
5297
5297
  }
5298
5298
  };
5299
+ var Policies = class {
5300
+ /**
5301
+ * List policies
5302
+ *
5303
+ * Returns the policies of the project `project_id` names, or of the project a project-scoped credential is bound to. Without either, the unrestricted admin lists every policy, global and project ones. Pass `user_id` (unrestricted admin only) to list only the policies attached to that user.
5304
+ *
5305
+ */
5306
+ static listPolicies(options) {
5307
+ return (options.client ?? client).get({
5308
+ url: "/v1/projects/{project_id}/policies",
5309
+ ...options
5310
+ });
5311
+ }
5312
+ /**
5313
+ * Create a policy
5314
+ *
5315
+ * Creates a project policy when `project_id` is given or the credential is bound to a project: its `Allow` statements may name only that project's resources (`srn:<project_id>:<type>:<id>`), else `400`. Without a project, creates a global policy, which only the unrestricted admin may.
5316
+ */
5317
+ static createPolicy(options) {
5318
+ return (options.client ?? client).post({
5319
+ url: "/v1/projects/{project_id}/policies",
5320
+ ...options,
5321
+ headers: {
5322
+ "Content-Type": "application/json",
5323
+ ...options.headers
5324
+ }
5325
+ });
5326
+ }
5327
+ /**
5328
+ * Delete a policy
5329
+ *
5330
+ * Deletes a policy. A project policy needs `policies:DeletePolicy` in its project; a global one, the unrestricted admin. Refused with `409 POLICY_HAS_DEPENDENTS` while a trigger, agent or webhook names it in its `policy_ids`.
5331
+ */
5332
+ static deletePolicy(options) {
5333
+ return (options.client ?? client).delete({
5334
+ url: "/v1/projects/{project_id}/policies/{policy_id}",
5335
+ ...options
5336
+ });
5337
+ }
5338
+ /**
5339
+ * Get a policy
5340
+ *
5341
+ * Returns a policy. A project policy needs `policies:GetPolicy` in its project; a global one, the unrestricted admin.
5342
+ */
5343
+ static getPolicy(options) {
5344
+ return (options.client ?? client).get({
5345
+ url: "/v1/projects/{project_id}/policies/{policy_id}",
5346
+ ...options
5347
+ });
5348
+ }
5349
+ /**
5350
+ * Update a policy
5351
+ *
5352
+ * Updates a policy. A project policy needs `policies:UpdatePolicy` in its project and its `Allow` statements stay within that project; a global one, the unrestricted admin. The project never changes.
5353
+ */
5354
+ static updatePolicy(options) {
5355
+ return (options.client ?? client).put({
5356
+ url: "/v1/projects/{project_id}/policies/{policy_id}",
5357
+ ...options,
5358
+ headers: {
5359
+ "Content-Type": "application/json",
5360
+ ...options.headers
5361
+ }
5362
+ });
5363
+ }
5364
+ };
5299
5365
  var Projects = class {
5300
5366
  /**
5301
5367
  * List projects
@@ -7019,6 +7085,7 @@ var NaturaliClient = class {
7019
7085
  models;
7020
7086
  orchestrations;
7021
7087
  playbooks;
7088
+ policies;
7022
7089
  projects;
7023
7090
  secrets;
7024
7091
  sessions;
@@ -7079,6 +7146,7 @@ var NaturaliClient = class {
7079
7146
  this.models = bindResource(Models, this.http);
7080
7147
  this.orchestrations = bindResource(Orchestrations, this.http);
7081
7148
  this.playbooks = bindResource(Playbooks, this.http);
7149
+ this.policies = bindResource(Policies, this.http);
7082
7150
  this.projects = bindResource(Projects, this.http);
7083
7151
  this.secrets = bindResource(Secrets, this.http);
7084
7152
  this.sessions = bindResource(Sessions, this.http);
@@ -7132,6 +7200,7 @@ exports.OauthClients = OauthClients;
7132
7200
  exports.OauthConnections = OauthConnections;
7133
7201
  exports.Orchestrations = Orchestrations;
7134
7202
  exports.Playbooks = Playbooks;
7203
+ exports.Policies = Policies;
7135
7204
  exports.Projects = Projects;
7136
7205
  exports.Quotas = Quotas;
7137
7206
  exports.Secrets = Secrets;