class PowerBI::GatewayDatasource

Attributes

connection_details[R]
credential_type[R]
datasource_name[R]
datasource_type[R]
gateway[R]
gateway_id[R]
id[R]

Public Class Methods

new(tenant, data) click to toggle source
# File lib/power-bi/gateway_datasource.rb, line 5
def initialize(tenant, data)
  @gateway_id = data[:gatewayId]
  @datasource_type = data[:datasourceType]
  @datasource_name = data[:datasourceName]
  @connection_details = data[:connectionDetails]
  @id = data[:id]
  @credential_type = data[:credentialType]
  @gateway = data[:gateway]
  @tenant = tenant
end

Public Instance Methods

delete() click to toggle source
# File lib/power-bi/gateway_datasource.rb, line 33
def delete
  @tenant.delete("/gateways/#{gateway.id}/datasources/#{id}")
  @gateway.gateway_datasources.reload
  true
end
update_credentials(encrypted_credentials) click to toggle source
# File lib/power-bi/gateway_datasource.rb, line 16
def update_credentials(encrypted_credentials)
  response = @tenant.patch("/gateways/#{gateway.id}/datasources/#{id}") do |req|
    req.body = {
      credentialDetails: {
        credentialType: "Basic",
        credentials: encrypted_credentials,
        encryptedConnection: "Encrypted",
        encryptionAlgorithm: "RSA-OAEP",
        privacyLevel: "Organizational",
        useCallerAADIdentity: false,
        useEndUserOAuth2Credentials: false,
      },
    }.to_json
  end
  true
end