Skip to content

Commit

Permalink
Merge pull request #115 from tombuildsstuff/f/datalakegen2-filesystem…
Browse files Browse the repository at this point in the history
…-encryption-scope

datalakestore/filesystems: support setting/getting default encryption scope
  • Loading branch information
manicminer authored Apr 9, 2024
2 parents f7e1986 + 93a07c2 commit bdd54c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 11 additions & 3 deletions storage/2023-11-03/datalakestore/filesystems/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
)

type CreateInput struct {
// The encryption scope to set as the default on the filesystem.
DefaultEncryptionScope string

// A map of base64-encoded strings to store as user-defined properties with the File System
// Note that items may only contain ASCII characters in the ISO-8859-1 character set.
// This automatically gets converted to a comma-separated list of name and
Expand All @@ -35,7 +38,7 @@ func (c Client) Create(ctx context.Context, fileSystemName string, input CreateI
},
HttpMethod: http.MethodPut,
OptionsObject: createOptions{
properties: input.Properties,
input: input,
},

Path: fmt.Sprintf("/%s", fileSystemName),
Expand All @@ -61,12 +64,17 @@ func (c Client) Create(ctx context.Context, fileSystemName string, input CreateI
}

type createOptions struct {
properties map[string]string
input CreateInput
}

func (o createOptions) ToHeaders() *client.Headers {
headers := &client.Headers{}
props := buildProperties(o.properties)

if o.input.DefaultEncryptionScope != "" {
headers.Append("x-ms-default-encryption-scope", o.input.DefaultEncryptionScope)
}

props := buildProperties(o.input.Properties)
if props != "" {
headers.Append("x-ms-properties", props)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
type GetPropertiesResponse struct {
HttpResponse *http.Response

// The default encryption scope for the filesystem.
DefaultEncryptionScope string

// A map of base64-encoded strings to store as user-defined properties with the File System
// Note that items may only contain ASCII characters in the ISO-8859-1 character set.
// This automatically gets converted to a comma-separated list of name and
Expand Down Expand Up @@ -51,6 +54,8 @@ func (c Client) GetProperties(ctx context.Context, fileSystemName string) (resul
result.HttpResponse = resp.Response

if resp.Header != nil {
result.DefaultEncryptionScope = resp.Header.Get("x-ms-default-encryption-scope")

propertiesRaw := resp.Header.Get("x-ms-properties")
var properties *map[string]string
properties, err = parseProperties(propertiesRaw)
Expand Down

0 comments on commit bdd54c4

Please sign in to comment.