A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/github/vulcanizer/commit/9c7fa78d612ae38319fa0830f0a9e9f95c480743 below:

Merge pull request #116 from github/dtaivpp/license-cluster · github/vulcanizer@9c7fa78 · GitHub

This repository was archived by the owner on Apr 15, 2025. It is now read-only.

File tree Expand file treeCollapse file tree 2 files changed

+40

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+40

-0

lines changed Original file line number Diff line number Diff line change

@@ -1802,3 +1802,24 @@ func (c *Client) RemoveIndexILMPolicy(index string) error {

1802 1802 1803 1803

return nil

1804 1804

}

1805 + 1806 +

// LicenseCluster takes in the Elasticsearch license encoded as a string

1807 +

func (c *Client) LicenseCluster(license string) error {

1808 +

// If the license is empty, return an error

1809 +

if license == "" {

1810 +

return errors.New("license is required")

1811 +

}

1812 + 1813 +

// Build the request to apply the license to the cluster

1814 +

agent := c.buildPutRequest("_license").

1815 +

Set("Content-Type", "application/json").

1816 +

Send(license)

1817 + 1818 +

// Execute the request

1819 +

_, err := handleErrWithBytes(agent)

1820 +

if err != nil {

1821 +

return err

1822 +

}

1823 + 1824 +

return nil

1825 +

}

Original file line number Diff line number Diff line change

@@ -2363,3 +2363,22 @@ func TestRemoveIndexILMPolicy(t *testing.T) {

2363 2363

t.Fatalf("Unexpected error. expected nil, got %s", err)

2364 2364

}

2365 2365

}

2366 +

func TestLicenseCluster(t *testing.T) {

2367 +

body := `{"license":{"start_date_in_millis":2728303200000,"uid":"asdfasdf-e"}}`

2368 + 2369 +

testSetup := &ServerSetup{

2370 +

Method: "PUT",

2371 +

Path: "/_license",

2372 +

Body: body,

2373 +

}

2374 + 2375 +

host, port, ts := setupTestServers(t, []*ServerSetup{testSetup})

2376 +

defer ts.Close()

2377 +

client := NewClient(host, port)

2378 + 2379 +

err := client.LicenseCluster(body)

2380 + 2381 +

if err != nil {

2382 +

t.Errorf("Unexpected error expected nil, got %s", err)

2383 +

}

2384 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4