Sha256: b4f64848e19d09f54d8f962e25ae697a7d064186667852922493058a3efba3c7

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

module Souls
  module Gcloud
    class << self
      def create_service_account service_account: "souls-app"
        `gcloud iam service-accounts create #{service_account} \
        --description="Souls Service Account" \
        --display-name="#{service_account}"`
      end

      def create_service_account_key service_account: "souls-app"
        project_id = Souls.configuration.project_id
        `gcloud iam service-accounts keys create ./config/keyfile.json \
          --iam-account #{service_account}@#{project_id}.iam.gserviceaccount.com`
      end

      def add_service_account_role service_account: "souls-app", role: "roles/firebase.admin"
        project_id = Souls.configuration.project_id
        `gcloud projects add-iam-policy-binding #{project_id} \
        --member="serviceAccount:#{service_account}@#{project_id}.iam.gserviceaccount.com" \
        --role="#{role}"`
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
souls-0.22.0 lib/souls/gcloud/iam.rb
souls-0.21.9 lib/souls/gcloud/iam.rb