[comment]: # ({04928fa3-04928fa3})
# discoveryrule.copy

[comment]: # ({/04928fa3-04928fa3})

[comment]: # ({4ab80a1a-9c0108a2})
::: noteimportant
Šī metode ir novecojusi un nākotnē tiks noņemta.
Tā vietā varat konfigurēt LLD noteikumus veidnēs un lietot šīs veidnes citām veidnēm vai hosts, tādējādi faktiski kopējot LLD noteikumus uz norādītajiem mērķiem.
:::

[comment]: # ({/4ab80a1a-9c0108a2})

[comment]: # ({67be7f89-8ae93b5b})
### Apraksts

`object discoveryrule.copy(object parameters)`

Šī metode ļauj kopēt LLD noteikumus ar visiem prototipiem uz norādītajiem hosts.

::: noteclassic
Šī metode ir pieejama tikai *Admin* un *Super admin* lietotāju tipiem. Tiesības izsaukt šo metodi var atsaukt lietotāju lomu iestatījumos. Plašāku informāciju skatiet [Lietotāju lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/67be7f89-8ae93b5b})

[comment]: # ({f027c7b5-47295f20})
### Parametri

`(object)` Parametri, kas nosaka kopējamās LLD noteikumu kopijas un mērķa hosts.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|discoveryids|array|To [LLD noteikumu](/manual/api/reference/discoveryrule/object#lld-rule) ID, kurus kopēt.|
|hostids|array|To [hosts](/manual/api/reference/host/object#host) ID, uz kuriem kopēt LLD noteikumus.|

[comment]: # ({/f027c7b5-47295f20})

[comment]: # ({b8760eee-b8760eee})
### Atgrieztās vērtības

`(boolean)` Atgriež `true`, ja kopēšana bija veiksmīga.

[comment]: # ({/b8760eee-b8760eee})

[comment]: # ({b41637d2-b41637d2})
### Piemēri

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({4bc5adc2-91be874e})
#### LLD noteikuma kopēšana uz vairākiem hosts

Kopējiet LLD noteikumu uz diviem hosts.

[Pieprasījums](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "discoveryrule.copy",
    "params": {
        "discoveryids": [
            "27426"
        ],
        "hostids": [
            "10196",
            "10197"
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": true,
    "id": 1
}
```

[comment]: # ({/4bc5adc2-91be874e})

[comment]: # ({823f655b-8870f994})
### Avots

CDiscoveryRule::copy() iekš
*ui/include/classes/api/services/CDiscoveryRule.php*.

[comment]: # ({/823f655b-8870f994})
