Class: Infrawrench::BackupsPoliciesNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.backups.policies

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ BackupsPoliciesNamespace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BackupsPoliciesNamespace.

Parameters:



1797
1798
1799
# File 'lib/infrawrench/client.rb', line 1797

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Create a backup policy

A policy must demand at least one of maxRpoHours and minRetentionDays — one that demands nothing could never produce a finding and would read as protection while providing none. An empty resourceTypeIds selects every stateful resource type.

POST /api/org/orgId/backups/policies

Raises on 400: Bad request

Raises on 409: Conflict

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as BackupPolicyCreate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (backup_policy_create, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as BackupPolicy — see sig/infrawrench/sdk.rbs.

Raises:



1820
1821
1822
1823
1824
1825
1826
1827
1828
# File 'lib/infrawrench/client.rb', line 1820

def create(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/backups/policies",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#delete(policy_id:, org_id: nil, request_options: nil) ⇒ nil

Delete a backup policy

Removes the objective. To stop a policy judging without losing it, set enabled to false instead.

DELETE /api/org/orgId/backups/policies/policyId

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • policy_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • policy_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (nil)

    This endpoint returns no content.

Raises:



1845
1846
1847
1848
1849
1850
1851
1852
1853
# File 'lib/infrawrench/client.rb', line 1845

def delete(policy_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/backups/policies/{policyId}",
    path_params: { "orgId" => org_id, "policyId" => policy_id },
    accept: :empty,
    request_options: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

List the organization's backup policies

The recovery objectives coverage is judged against. A policy selects resources by type and/or tag and demands a maximum RPO, a minimum retention, or both.

GET /api/org/orgId/backups/policies

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as BackupPolicyList — see sig/infrawrench/sdk.rbs.

Raises:



1868
1869
1870
1871
1872
1873
1874
1875
# File 'lib/infrawrench/client.rb', line 1868

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/backups/policies",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#update(policy_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Update a backup policy

Omitted fields are left alone; an explicit null clears tagKey, tagValue, maxRpoHours or minRetentionDays. The result is validated after merging, so a patch that would leave the policy demanding nothing is rejected.

PATCH /api/org/orgId/backups/policies/policyId

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • policy_id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as BackupPolicyUpdate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • policy_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: (backup_policy_update, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as BackupPolicy — see sig/infrawrench/sdk.rbs.

Raises:



1897
1898
1899
1900
1901
1902
1903
1904
1905
# File 'lib/infrawrench/client.rb', line 1897

def update(policy_id:, org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "PATCH",
    path: "/api/org/{orgId}/backups/policies/{policyId}",
    path_params: { "orgId" => org_id, "policyId" => policy_id },
    body: body,
    request_options: request_options
  )
end