[8.6] [Fleet] Rename parameter source_uri to sourceURI in agent policy (#146303) (#147204)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Fleet] Rename parameter source_uri to sourceURI in agent policy
(#146303)](https://github.com/elastic/kibana/pull/146303)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-30T13:46:19Z","message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.7.0"],"number":146303,"url":"https://github.com/elastic/kibana/pull/146303","mergeCommit":{"message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146303","number":146303,"mergeCommit":{"message":"[Fleet]
Rename parameter source_uri to sourceURI in agent policy (#146303)\n\n##
Summary\r\nCloses
https://github.com/elastic/kibana/issues/141470\r\n\r\nThe source_uri
parameter in agent policy should actually be `sourceURI`.\r\nI didn't
change the parameter everywhere in the code but only where is\r\nexposed
to the agent policy/actions, since in other places is only
used\r\ninternally by fleet.\r\n\r\n<img width=\"748\" alt=\"Screenshot
2022-11-24 at 15 59
54\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/203814663-b9e37be2-5017-4aba-94da-9f928de490c8.png\">\r\n\r\n\r\n###
Checklist\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fbd040febb23db22a38ee40b0efdedaa65508f4d"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-12-07 13:25:38 -05:00 committed by GitHub
parent a1da1113a1
commit b183fc5e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 14 deletions

View file

@ -110,7 +110,7 @@ export interface FullAgentPolicy {
metrics: boolean;
logs: boolean;
};
download: { source_uri: string };
download: { sourceURI: string };
};
}

View file

@ -4,7 +4,7 @@ exports[`Fleet preconfiguration reset Preconfigured cloud policy With a full pre
Object {
"agent": Object {
"download": Object {
"source_uri": "https://artifacts.elastic.co/downloads/",
"sourceURI": "https://artifacts.elastic.co/downloads/",
},
"monitoring": Object {
"enabled": false,

View file

@ -4,7 +4,7 @@ exports[`getFullAgentPolicy should support a different data output 1`] = `
Object {
"agent": Object {
"download": Object {
"source_uri": "http://default-registry.co",
"sourceURI": "http://default-registry.co",
},
"monitoring": Object {
"enabled": true,
@ -69,7 +69,7 @@ exports[`getFullAgentPolicy should support a different monitoring output 1`] = `
Object {
"agent": Object {
"download": Object {
"source_uri": "http://default-registry.co",
"sourceURI": "http://default-registry.co",
},
"monitoring": Object {
"enabled": true,
@ -134,7 +134,7 @@ exports[`getFullAgentPolicy should support both different outputs for data and m
Object {
"agent": Object {
"download": Object {
"source_uri": "http://default-registry.co",
"sourceURI": "http://default-registry.co",
},
"monitoring": Object {
"enabled": true,

View file

@ -228,7 +228,7 @@ describe('getFullAgentPolicy', () => {
},
agent: {
download: {
source_uri: 'http://default-registry.co',
sourceURI: 'http://default-registry.co',
},
monitoring: {
namespace: 'default',
@ -264,7 +264,7 @@ describe('getFullAgentPolicy', () => {
},
agent: {
download: {
source_uri: 'http://default-registry.co',
sourceURI: 'http://default-registry.co',
},
monitoring: {
namespace: 'default',
@ -349,7 +349,7 @@ describe('getFullAgentPolicy', () => {
expect(agentPolicy?.outputs.default).toBeDefined();
});
it('should return the source_uri from the agent policy', async () => {
it('should return the sourceURI from the agent policy', async () => {
mockAgentPolicy({
namespace: 'default',
revision: 1,
@ -373,7 +373,7 @@ describe('getFullAgentPolicy', () => {
},
agent: {
download: {
source_uri: 'http://custom-registry-test',
sourceURI: 'http://custom-registry-test',
},
monitoring: {
namespace: 'default',

View file

@ -132,7 +132,7 @@ export async function getFullAgentPolicy(
revision: agentPolicy.revision,
agent: {
download: {
source_uri: sourceUri,
sourceURI: sourceUri,
},
monitoring:
agentPolicy.monitoring_enabled && agentPolicy.monitoring_enabled.length > 0

View file

@ -39,7 +39,7 @@ export async function sendUpgradeAgentAction({
const now = new Date().toISOString();
const data = {
version,
source_uri: sourceUri,
sourceURI: sourceUri,
};
const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId);

View file

@ -100,7 +100,7 @@ export async function upgradeBatch(
const now = new Date().toISOString();
const data = {
version: options.version,
source_uri: options.sourceUri,
sourceURI: options.sourceUri,
};
const rollingUpgradeOptions = getRollingUpgradeOptions(

View file

@ -217,7 +217,7 @@ export default function (providerContext: FtrProviderContext) {
},
});
const action: any = actionsRes.hits.hits[0]._source;
expect(action.data.source_uri).contain('http://path/to/download');
expect(action.data.sourceURI).contain('http://path/to/download');
});
it('should respond 400 if trying to upgrade to a version that does not match installed kibana version', async () => {
const kibanaVersion = await kibanaServer.version.get();
@ -976,7 +976,7 @@ export default function (providerContext: FtrProviderContext) {
});
const action: any = actionsRes.hits.hits[0]._source;
expect(action.data.source_uri).contain('http://path/to/download');
expect(action.data.sourceURI).contain('http://path/to/download');
});
it('enrolled in a hosted agent policy bulk upgrade should respond with 200 and object of results. Should not update the hosted agent SOs', async () => {