google-nomulus/java/google/registry/tools/soy/DomainUpdate.soy
guyben 2e62ad2658 Allow setting DS records in create_domain and update_domain
The DS records consist of 4 values:
- keyTag: unsigned short (2 bytes)
- alg: unsigned byte
- digestType: unsigned byte
- digest: binary hex

NOTE: the current CL doesn't support keyData, neither as the optional field in dsData nor as a replacement for dsData

The command tool accepts DS records as a string, where the 4 values are given
as one string separated by white-spaces as follows:
<keyTag> <alg>  <digestType>  <digest>

e.g. something like:
60485 5  2  D4B7D520E7BB5F0F67674A0CCEB1E3E0614B93C4F9E99B8383F6A1E4469DA50A

which is how it's written in Zone files, allowing easy copy-paste from existing values.
ommas is confusing when using spaces.

The various "numbers" (keyTag, alg, digestType) are only checked that they are
positive integers - the rest is left for the server.

digest it checked to be an even-lengthed hex string.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184583068
2018-02-05 23:56:16 -05:00

137 lines
4.9 KiB
Text

// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace domain.registry.tools}
/**
* Update domain
*/
{template .domainupdate stricthtml="false"}
{@param domain: string}
{@param add: bool}
{@param addNameservers: list<string>}
{@param addAdmins: list<string>}
{@param addTechs: list<string>}
{@param addStatuses: list<string>}
{@param remove: bool}
{@param removeNameservers: list<string>}
{@param removeAdmins: list<string>}
{@param removeTechs: list<string>}
{@param removeStatuses: list<string>}
{@param change: bool}
{@param? registrant: string}
{@param? password: string}
{@param secdns: bool}
{@param addDsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
{@param removeDsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
{@param removeAllDsRecords: bool}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>{$domain}</domain:name>
{if $add}
<domain:add>
{if length($addNameservers) > 0}
<domain:ns>
{for $s in $addNameservers}
<domain:hostObj>{$s}</domain:hostObj>
{/for}
</domain:ns>
{/if}
{for $admin in $addAdmins}
<domain:contact type="admin">{$admin}</domain:contact>
{/for}
{for $tech in $addTechs}
<domain:contact type="tech">{$tech}</domain:contact>
{/for}
{for $status in $addStatuses}
<domain:status s="{$status}"/>
{/for}
</domain:add>
{/if}
{if $remove}
<domain:rem>
{if length($removeNameservers) > 0}
<domain:ns>
{for $s in $removeNameservers}
<domain:hostObj>{$s}</domain:hostObj>
{/for}
</domain:ns>
{/if}
{for $admin in $removeAdmins}
<domain:contact type="admin">{$admin}</domain:contact>
{/for}
{for $tech in $removeTechs}
<domain:contact type="tech">{$tech}</domain:contact>
{/for}
{for $status in $removeStatuses}
<domain:status s="{$status}"/>
{/for}
</domain:rem>
{/if}
{if $change}
<domain:chg>
{if $registrant}
<domain:registrant>{$registrant}</domain:registrant>
{/if}
{if $password}
<domain:authInfo>
<domain:pw>{$password}</domain:pw>
</domain:authInfo>
{/if}
</domain:chg>
{/if}
</domain:update>
</update>
{if $secdns}
<extension>
<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
{if $removeAllDsRecords}
<secDNS:rem>
<secDNS:all>true</secDNS:all>
</secDNS:rem>
{/if}
{if length($removeDsRecords) > 0}
<secDNS:rem>
{for $dsRecord in $removeDsRecords}
<secDNS:dsData>
<secDNS:keyTag>{$dsRecord.keyTag}</secDNS:keyTag>
<secDNS:alg>{$dsRecord.alg}</secDNS:alg>
<secDNS:digestType>{$dsRecord.digestType}</secDNS:digestType>
<secDNS:digest>{$dsRecord.digest}</secDNS:digest>
</secDNS:dsData>
{/for}
</secDNS:rem>
{/if}
{if length($addDsRecords) > 0}
<secDNS:add>
{for $dsRecord in $addDsRecords}
<secDNS:dsData>
<secDNS:keyTag>{$dsRecord.keyTag}</secDNS:keyTag>
<secDNS:alg>{$dsRecord.alg}</secDNS:alg>
<secDNS:digestType>{$dsRecord.digestType}</secDNS:digestType>
<secDNS:digest>{$dsRecord.digest}</secDNS:digest>
</secDNS:dsData>
{/for}
</secDNS:add>
{/if}
</secDNS:update>
</extension>
{/if}
<clTRID>RegistryTool</clTRID>
</command>
</epp>
{/template}