클래스: Mongo::Crypt::KMS::MasterKeyDocument 비공개

상속:
객체
  • 객체
모두 표시
다음에 정의됨:
lib/ Mongo/crypt/ KMS/master_key_document.rb

개요

이 클래스는 비공개 API의 일부입니다. 이 클래스는 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.

KMS 마스터 키 문서 객체에는 데이터 키 생성에 사용되는 KMS 마스터 키 매개 변수가 포함되어 있습니다.

상수 요약 접기

KMS_PROVIDERS =

이 상수는 비공개 API의 일부입니다. 이 상수는 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.

Known KMS provider types.

%w[AWS Azure GCP KMIP 로컬].동결

인스턴스 메서드 요약 접기

생성자 세부 정보

#initialize(kms_provider, options) ⇒ MasterKeyDocument

이 메서드는 비공개 API의 일부입니다. 이 방법은 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.

Creates a master key document object from a parameters hash.

매개변수:

  • kms_provider (string)

    KMS provider identifier. May be a provider type (e.g. "aws") or a named provider (e.g. "aws:name1").

  • 옵션 (해시)

    KMS 제공자 에 대한 마스터 키 옵션이 포함된 해시입니다. KMS 제공자에 대한 필수 매개변수는 Mongo::Crypt:: KMS 모듈 내의 해당 클래스에 설명되어 있습니다.

다음을 발생시킵니다.

  • (ArgumentError)

    필수 옵션이 누락되었거나 형식이 잘못된 경우.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 파일 'lib/ Mongo/crypt/ KMS/master_key_document.rb', 줄 39

def 초기화(kms_provider, 옵션)
  올리다 ArgumentError.신규(' 키 문서 옵션은 'nil ' 이 아니어야 합니다 .) 만약 옵션.nil?

  @provider = kms_provider.to_s
  provider_type = KMS.provider_base_type(@provider)

  master_key = 옵션.가져오기(:master_key, {})
  @key_document = case provider_type
                  when 'aws' then KMS::AWS::MasterKeyDocument.신규(master_key)
                  when 'azure' then KMS::Azure::MasterKeyDocument.신규(master_key)
                  when 'gcp' then KMS::GCP::MasterKeyDocument.신규(master_key)
                  when 'kmip' then KMS::KMIP::MasterKeyDocument.신규(master_key)
                  when 'local' then KMS::로컬::MasterKeyDocument.신규(master_key)
                  other
                    올리다 ArgumentError.신규("KMS 제공자 는 다음 중 하나여야 합니다.#{KMS_PROVIDERS}")
                  end
end

인스턴스 메서드 세부 정보

#to_documentBSON::Document

이 메서드는 비공개 API의 일부입니다. 이 방법은 향후 제거되거나 변경될 수 있으므로 가능하면 사용하지 않는 것이 좋습니다.

마스터 키 문서 객체를 libmongocrypt 형식의 BSON 문서로 변환합니다.

반환합니다:

  • (BSON::Document)

    마스터 키 문서 를 BSON 문서 로 설정합니다.



60
61
62
# 파일 'lib/ Mongo/crypt/ KMS/master_key_document.rb', 줄 60

def to_document
  @key_document.to_document.merge(제공자: @provider)
end