forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
33 lines
3.6 KiB
HTML
33 lines
3.6 KiB
HTML
<a name="cce_02_0085"></a><a name="cce_02_0085"></a>
|
|
|
|
<h1 class="topictitle1">Patch Request Method Operation Description</h1>
|
|
<div id="body8662426"><p id="cce_02_0085__p57818045">Kubernetes APIs use the HTTP header "Content-Type" to distinguish between patch request method operations.</p>
|
|
<div class="section" id="cce_02_0085__s8aafd6c4a7764494b1ed22d2e4a178bf"><h4 class="sectiontitle">Operation Description</h4><p id="cce_02_0085__p12969758">Currently, three types of patch request method operations are supported:</p>
|
|
<ol id="cce_02_0085__o921247c9b5b5459bbe90e8aa65fbf948"><li id="cce_02_0085__li43917482"><strong id="cce_02_0085__b59713022">JSON Patch, Content-Type: application/json-patch+json</strong><p class="litext" id="cce_02_0085__p546286">According to RFC 6902, JSON patch operations indicate a series of operations performed on resource objects. The following provides an example of the JSON patch operation:</p>
|
|
<pre class="screen" id="cce_02_0085__screen15139080172934">{
|
|
"op": "add",
|
|
"path": "/spec/containers/0/image",
|
|
"value": "busybox:latest"
|
|
}</pre>
|
|
<p class="litext" id="cce_02_0085__p6290207">In the preceding example:</p>
|
|
<ul class="subitemlist" id="cce_02_0085__ul56611863"><li id="cce_02_0085__li39744725">"op" indicates a series of operations performed on resource objects, and it contains the following operations:<p id="cce_02_0085__p27453836153649"><a name="cce_02_0085__li39744725"></a><a name="li39744725"></a>add</p>
|
|
<p id="cce_02_0085__p27472357153649">replace</p>
|
|
<p id="cce_02_0085__p29120671153649">remove (not supported)</p>
|
|
<p id="cce_02_0085__p41602957153649">move (not supported)</p>
|
|
<p id="cce_02_0085__p11675736153649">copy (not supported)</p>
|
|
<p id="cce_02_0085__p32507584153649">test (not supported)</p>
|
|
</li><li id="cce_02_0085__li59424934153635">"path" indicates the path to the to-be-operated resource object.<p id="cce_02_0085__p42176097153633"><a name="cce_02_0085__li59424934153635"></a><a name="li59424934153635"></a>For example, <strong id="cce_02_0085__b62685170153633">/spec/containers/0/image</strong> indicates that the object to be operated is <strong id="cce_02_0085__b8944420153633">spec.containers[0].image</strong>.</p>
|
|
</li><li id="cce_02_0085__li5367678153641">"value" indicates the to-be-modified value.</li></ul>
|
|
</li><li id="cce_02_0085__li45529105"><strong id="cce_02_0085__b7108768">Merge Patch, Content-Type: application/merge-patch+json</strong><p class="litext" id="cce_02_0085__p63978914">According to RFC 7386, merge patch contains some description of a resource object (namely, JSON object). The JSON object is submitted to the server end, and merges with the current object of the server end (that is, replaces the list field of the current resource object) to form a new object.</p>
|
|
</li><li id="cce_02_0085__li14909584"><strong id="cce_02_0085__b67077397">Strategic Merge Patch, Content-Type: application/strategic-merge-patch+json</strong><p id="cce_02_0085__p44169889">Strategic merge patch is used to add legal metadata to API objects, and uses new metadata to determine which list should be merged and which should not. The current metadata is used as the structure labels.</p>
|
|
</li></ol>
|
|
<p id="cce_02_0085__p26961812174213">For more information about the difference between <span class="parmname" id="cce_02_0085__parmname40088177174213"><b>Merge Patch</b></span> and <span class="parmname" id="cce_02_0085__parmname21706447174213"><b>Strategic Merge Patch</b></span>, see <a href="cce_02_0086.html">Patch Request Method Operation Example</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_02_0083.html">Appendix</a></div>
|
|
</div>
|
|
</div>
|
|
|