2121 * @api
2222 * @author Glen Campbell <[email protected] > 2323 */
24- class Domain extends Object
24+ class Domain extends Object
2525{
2626
2727 public $ id ;
@@ -38,9 +38,9 @@ class Domain extends Object
3838 protected static $ url_resource = 'domains ' ;
3939
4040 protected $ _create_keys = array (
41- 'name ' ,
42- 'emailAddress ' ,
43- 'ttl ' ,
41+ 'name ' ,
42+ 'emailAddress ' ,
43+ 'ttl ' ,
4444 'comment '
4545 );
4646
@@ -61,7 +61,7 @@ class Domain extends Object
6161 *
6262 * @return Record
6363 */
64- public function Record ($ info = null )
64+ public function Record ($ info = null )
6565 {
6666 return new Record ($ this , $ info );
6767 }
@@ -72,7 +72,7 @@ public function Record($info = null)
7272 * @param array $filter query-string parameters
7373 * @return \OpenCloud\Collection
7474 */
75- public function RecordList ($ filter = array ())
75+ public function RecordList ($ filter = array ())
7676 {
7777 return $ this ->Parent ()->Collection ('\OpenCloud\DNS\Record ' , null , $ this , $ filter );
7878 }
@@ -81,7 +81,7 @@ public function RecordList($filter = array())
8181 * returns a Subdomain object (child of current domain)
8282 *
8383 */
84- public function Subdomain ($ info = array ())
84+ public function Subdomain ($ info = array ())
8585 {
8686 return new Subdomain ($ this , $ info );
8787 }
@@ -95,7 +95,7 @@ public function Subdomain($info = array())
9595 * @param array $filter key/value pairs for query string parameters
9696 * return \OpenCloud\Collection
9797 */
98- public function SubdomainList ($ filter = array ())
98+ public function SubdomainList ($ filter = array ())
9999 {
100100 return $ this ->Parent ()->Collection ('\OpenCloud\DNS\Subdomain ' , null , $ this );
101101 }
@@ -107,7 +107,7 @@ public function SubdomainList($filter = array())
107107 * @param Record $rec the record to add
108108 * @return integer the number of records
109109 */
110- public function AddRecord (Record $ record )
110+ public function AddRecord (Record $ record )
111111 {
112112 $ this ->records [] = $ record ;
113113 return count ($ this ->records );
@@ -120,7 +120,7 @@ public function AddRecord(Record $record)
120120 * @param Subdomain $subd the subdomain to add
121121 * @return integer the number of subdomains
122122 */
123- public function AddSubdomain (Subdomain $ subdomain )
123+ public function AddSubdomain (Subdomain $ subdomain )
124124 {
125125 $ this ->subdomains [] = $ subdomain ;
126126 return count ($ this ->subdomains );
@@ -132,7 +132,7 @@ public function AddSubdomain(Subdomain $subdomain)
132132 * @param string $since the date or time
133133 * @return DNS\Changes
134134 */
135- public function Changes ($ since = null )
135+ public function Changes ($ since = null )
136136 {
137137 if (isset ($ since )) {
138138 $ url = $ this ->Url ('changes ' , array ('since ' => $ since ));
@@ -149,19 +149,52 @@ public function Changes($since = null)
149149 *
150150 * @return AsyncResponse
151151 */
152- public function Export ()
152+ public function Export ()
153153 {
154154 $ url = $ this ->Url ('export ' );
155155 return $ this ->Service ()->AsyncRequest ($ url );
156156 }
157157
158+ /**
159+ * clones the domain to the specified target domain
160+ *
161+ * @param string $newdomain the new domain to create from this domain
162+ * @param boolean $sub to clone subdomains as well
163+ * @param boolean $comments Replace occurrences of the reference domain
164+ * name with the new domain name in comments
165+ * @param boolean $email Replace occurrences of the reference domain
166+ * name with the new domain name in email addresses on the cloned
167+ * (new) domain.
168+ * @param boolean $records Replace occurrences of the reference domain
169+ * name with the new domain name in data fields (of records) on the
170+ * cloned (new) domain. Does not affect NS records.
171+ * @return AsyncResponse
172+ */
173+ public function CloneDomain (
174+ $ newdomain ,
175+ $ sub =TRUE ,
176+ $ comments =TRUE ,
177+ $ email =TRUE ,
178+ $ records =TRUE )
179+ {
180+ $ param = array (
181+ 'cloneName ' => $ newdomain ,
182+ 'cloneSubdomains ' => $ sub ,
183+ 'modifyComment ' => $ comments ,
184+ 'modifyEmailAddress ' => $ email ,
185+ 'modifyRecordData ' => $ records
186+ );
187+ $ url = $ this ->Url ('clone ' , $ param );
188+ return $ this ->Service ()->AsyncRequest ($ url );
189+ }
190+
158191 /**
159192 * handles creation of multiple records at Create()
160193 *
161194 * @api
162195 * @return \stdClass
163196 */
164- protected function CreateJson ()
197+ protected function CreateJson ()
165198 {
166199 $ object = parent ::CreateJson ();
167200
@@ -200,4 +233,4 @@ protected function CreateJson()
200233 return $ object ;
201234 }
202235
203- }
236+ }
0 commit comments