...

Source file src/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_not_enabled.go

Documentation: go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt

     1  // Copyright (C) MongoDB, Inc. 2017-present.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License"); you may
     4  // not use this file except in compliance with the License. You may obtain
     5  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
     6  
     7  //go:build !cse
     8  // +build !cse
     9  
    10  package mongocrypt
    11  
    12  import (
    13  	"context"
    14  
    15  	"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
    16  	"go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/options"
    17  )
    18  
    19  const cseNotSupportedMsg = "client-side encryption not enabled. add the cse build tag to support"
    20  
    21  // MongoCrypt represents a mongocrypt_t handle.
    22  type MongoCrypt struct{}
    23  
    24  // Version returns the version string for the loaded libmongocrypt, or an empty string
    25  // if libmongocrypt was not loaded.
    26  func Version() string {
    27  	return ""
    28  }
    29  
    30  // NewMongoCrypt constructs a new MongoCrypt instance configured using the provided MongoCryptOptions.
    31  func NewMongoCrypt(*options.MongoCryptOptions) (*MongoCrypt, error) {
    32  	panic(cseNotSupportedMsg)
    33  }
    34  
    35  // CreateEncryptionContext creates a Context to use for encryption.
    36  func (m *MongoCrypt) CreateEncryptionContext(string, bsoncore.Document) (*Context, error) {
    37  	panic(cseNotSupportedMsg)
    38  }
    39  
    40  // CreateExplicitEncryptionExpressionContext creates a Context to use for explicit encryption of an expression.
    41  func (m *MongoCrypt) CreateExplicitEncryptionExpressionContext(bsoncore.Document, *options.ExplicitEncryptionOptions) (*Context, error) {
    42  	panic(cseNotSupportedMsg)
    43  }
    44  
    45  // CreateDecryptionContext creates a Context to use for decryption.
    46  func (m *MongoCrypt) CreateDecryptionContext(bsoncore.Document) (*Context, error) {
    47  	panic(cseNotSupportedMsg)
    48  }
    49  
    50  // CreateDataKeyContext creates a Context to use for creating a data key.
    51  func (m *MongoCrypt) CreateDataKeyContext(string, *options.DataKeyOptions) (*Context, error) {
    52  	panic(cseNotSupportedMsg)
    53  }
    54  
    55  // CreateExplicitEncryptionContext creates a Context to use for explicit encryption.
    56  func (m *MongoCrypt) CreateExplicitEncryptionContext(bsoncore.Document, *options.ExplicitEncryptionOptions) (*Context, error) {
    57  	panic(cseNotSupportedMsg)
    58  }
    59  
    60  // RewrapDataKeyContext creates a Context to use for rewrapping a data key.
    61  func (m *MongoCrypt) RewrapDataKeyContext([]byte, *options.RewrapManyDataKeyOptions) (*Context, error) {
    62  	panic(cseNotSupportedMsg)
    63  }
    64  
    65  // CreateExplicitDecryptionContext creates a Context to use for explicit decryption.
    66  func (m *MongoCrypt) CreateExplicitDecryptionContext(bsoncore.Document) (*Context, error) {
    67  	panic(cseNotSupportedMsg)
    68  }
    69  
    70  // CryptSharedLibVersion returns the version number for the loaded crypt_shared library, or 0 if the
    71  // crypt_shared library was not loaded.
    72  func (m *MongoCrypt) CryptSharedLibVersion() uint64 {
    73  	panic(cseNotSupportedMsg)
    74  }
    75  
    76  // CryptSharedLibVersionString returns the version string for the loaded crypt_shared library, or an
    77  // empty string if the crypt_shared library was not loaded.
    78  func (m *MongoCrypt) CryptSharedLibVersionString() string {
    79  	panic(cseNotSupportedMsg)
    80  }
    81  
    82  // Close cleans up any resources associated with the given MongoCrypt instance.
    83  func (m *MongoCrypt) Close() {
    84  	panic(cseNotSupportedMsg)
    85  }
    86  
    87  // GetKmsProviders returns the originally configured KMS providers.
    88  func (m *MongoCrypt) GetKmsProviders(context.Context) (bsoncore.Document, error) {
    89  	panic(cseNotSupportedMsg)
    90  }
    91  

View as plain text