Class: Hivehook::Resources::OrganizationService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/hivehook/resources/organization_service.rb

Constant Summary collapse

FRAGMENT =
"id name slug ssoEnabled ssoProvider retentionEvents retentionMessages otlpConfig { endpoint headers insecure sampleRate } createdAt updatedAt"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Hivehook::Resources::BaseService

Instance Method Details

#configure_otlp(organization_id, input) ⇒ Object



63
64
65
66
# File 'lib/hivehook/resources/organization_service.rb', line 63

def configure_otlp(organization_id, input)
  query = "mutation($organizationId: UUID!, $input: OTLPConfigInput!) { configureOTLP(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "organizationId" => organization_id, "input" => input })["configureOTLP"]
end

#configure_sso(organization_id, input) ⇒ Object



38
39
40
41
# File 'lib/hivehook/resources/organization_service.rb', line 38

def configure_sso(organization_id, input)
  query = "mutation($organizationId: UUID!, $input: SSOConfigInput!) { configureSSO(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "organizationId" => organization_id, "input" => input })["configureSSO"]
end

#create(input) ⇒ Object



23
24
25
26
# File 'lib/hivehook/resources/organization_service.rb', line 23

def create(input)
  query = "mutation($input: CreateOrganizationInput!) { createOrganization(input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "input" => input })["createOrganization"]
end

#delete(id) ⇒ Object



33
34
35
36
# File 'lib/hivehook/resources/organization_service.rb', line 33

def delete(id)
  query = "mutation($id: UUID!) { deleteOrganization(id: $id) }"
  @transport.execute(query, { "id" => id })["deleteOrganization"]
end

#delete_data(organization_id) ⇒ Object



53
54
55
56
# File 'lib/hivehook/resources/organization_service.rb', line 53

def delete_data(organization_id)
  query = "mutation($organizationId: UUID!) { deleteOrganizationData(organizationId: $organizationId) }"
  @transport.execute(query, { "organizationId" => organization_id })["deleteOrganizationData"]
end

#disable_otlp(organization_id) ⇒ Object



68
69
70
71
# File 'lib/hivehook/resources/organization_service.rb', line 68

def disable_otlp(organization_id)
  query = "mutation($organizationId: UUID!) { disableOTLP(organizationId: $organizationId) { #{FRAGMENT} } }"
  @transport.execute(query, { "organizationId" => organization_id })["disableOTLP"]
end

#disable_sso(organization_id) ⇒ Object



43
44
45
46
# File 'lib/hivehook/resources/organization_service.rb', line 43

def disable_sso(organization_id)
  query = "mutation($organizationId: UUID!) { disableSSO(organizationId: $organizationId) { #{FRAGMENT} } }"
  @transport.execute(query, { "organizationId" => organization_id })["disableSSO"]
end

#export_data(organization_id) ⇒ Object



58
59
60
61
# File 'lib/hivehook/resources/organization_service.rb', line 58

def export_data(organization_id)
  query = "mutation($organizationId: UUID!) { exportOrganizationData(organizationId: $organizationId) }"
  @transport.execute(query, { "organizationId" => organization_id })["exportOrganizationData"]
end

#get(id) ⇒ Object



18
19
20
21
# File 'lib/hivehook/resources/organization_service.rb', line 18

def get(id)
  query = "query($id: UUID!) { organization(id: $id) { #{FRAGMENT} } }"
  @transport.execute(query, { "id" => id })["organization"]
end

#list(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/hivehook/resources/organization_service.rb', line 8

def list(options = {})
  query = "query($search: String, $limit: Int, $offset: Int) {
    organizations(search: $search, limit: $limit, offset: $offset) {
      nodes { #{FRAGMENT} }
      pageInfo { total limit offset endCursor hasNextPage }
    }
  }"
  @transport.execute(query, build_variables(options, %w[search limit offset]))["organizations"]
end

#update(id, input) ⇒ Object



28
29
30
31
# File 'lib/hivehook/resources/organization_service.rb', line 28

def update(id, input)
  query = "mutation($id: UUID!, $input: UpdateOrganizationInput!) { updateOrganization(id: $id, input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "id" => id, "input" => input })["updateOrganization"]
end

#update_retention(organization_id, input) ⇒ Object



48
49
50
51
# File 'lib/hivehook/resources/organization_service.rb', line 48

def update_retention(organization_id, input)
  query = "mutation($organizationId: UUID!, $input: RetentionInput!) { updateOrganizationRetention(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
  @transport.execute(query, { "organizationId" => organization_id, "input" => input })["updateOrganizationRetention"]
end