/sdk/appservice/mgmt-v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificateImpl.java

http://github.com/WindowsAzure/azure-sdk-for-java · Java · 242 lines · 198 code · 37 blank · 7 comment · 13 complexity · 243a361c1ff34b77f88cce0887085b42 MD5 · raw file

  1. /**
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for
  4. * license information.
  5. *
  6. * Code generated by Microsoft (R) AutoRest Code Generator.
  7. */
  8. package com.microsoft.azure.management.appservice.v2016_03_01.implementation;
  9. import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl;
  10. import com.microsoft.azure.management.appservice.v2016_03_01.Certificate;
  11. import rx.Observable;
  12. import com.microsoft.azure.management.appservice.v2016_03_01.CertificatePatchResource;
  13. import java.util.List;
  14. import org.joda.time.DateTime;
  15. import com.microsoft.azure.management.appservice.v2016_03_01.HostingEnvironmentProfile;
  16. import com.microsoft.azure.management.appservice.v2016_03_01.KeyVaultSecretStatus;
  17. import rx.functions.Func1;
  18. class CertificateImpl extends GroupableResourceCoreImpl<Certificate, CertificateInner, CertificateImpl, AppServiceManager> implements Certificate, Certificate.Definition, Certificate.Update {
  19. private CertificatePatchResource updateParameter;
  20. CertificateImpl(String name, CertificateInner inner, AppServiceManager manager) {
  21. super(name, inner, manager);
  22. this.updateParameter = new CertificatePatchResource();
  23. }
  24. @Override
  25. public Observable<Certificate> createResourceAsync() {
  26. CertificatesInner client = this.manager().inner().certificates();
  27. return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner())
  28. .map(new Func1<CertificateInner, CertificateInner>() {
  29. @Override
  30. public CertificateInner call(CertificateInner resource) {
  31. resetCreateUpdateParameters();
  32. return resource;
  33. }
  34. })
  35. .map(innerToFluentMap(this));
  36. }
  37. @Override
  38. public Observable<Certificate> updateResourceAsync() {
  39. CertificatesInner client = this.manager().inner().certificates();
  40. return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter)
  41. .map(new Func1<CertificateInner, CertificateInner>() {
  42. @Override
  43. public CertificateInner call(CertificateInner resource) {
  44. resetCreateUpdateParameters();
  45. return resource;
  46. }
  47. })
  48. .map(innerToFluentMap(this));
  49. }
  50. @Override
  51. protected Observable<CertificateInner> getInnerAsync() {
  52. CertificatesInner client = this.manager().inner().certificates();
  53. return client.getByResourceGroupAsync(this.resourceGroupName(), this.name());
  54. }
  55. @Override
  56. public boolean isInCreateMode() {
  57. return this.inner().id() == null;
  58. }
  59. private void resetCreateUpdateParameters() {
  60. this.updateParameter = new CertificatePatchResource();
  61. }
  62. @Override
  63. public byte[] cerBlob() {
  64. return this.inner().cerBlob();
  65. }
  66. @Override
  67. public DateTime expirationDate() {
  68. return this.inner().expirationDate();
  69. }
  70. @Override
  71. public String friendlyName() {
  72. return this.inner().friendlyName();
  73. }
  74. @Override
  75. public String geoRegion() {
  76. return this.inner().geoRegion();
  77. }
  78. @Override
  79. public HostingEnvironmentProfile hostingEnvironmentProfile() {
  80. return this.inner().hostingEnvironmentProfile();
  81. }
  82. @Override
  83. public List<String> hostNames() {
  84. return this.inner().hostNames();
  85. }
  86. @Override
  87. public DateTime issueDate() {
  88. return this.inner().issueDate();
  89. }
  90. @Override
  91. public String issuer() {
  92. return this.inner().issuer();
  93. }
  94. @Override
  95. public String keyVaultId() {
  96. return this.inner().keyVaultId();
  97. }
  98. @Override
  99. public String keyVaultSecretName() {
  100. return this.inner().keyVaultSecretName();
  101. }
  102. @Override
  103. public KeyVaultSecretStatus keyVaultSecretStatus() {
  104. return this.inner().keyVaultSecretStatus();
  105. }
  106. @Override
  107. public String kind() {
  108. return this.inner().kind();
  109. }
  110. @Override
  111. public String password() {
  112. return this.inner().password();
  113. }
  114. @Override
  115. public byte[] pfxBlob() {
  116. return this.inner().pfxBlob();
  117. }
  118. @Override
  119. public String publicKeyHash() {
  120. return this.inner().publicKeyHash();
  121. }
  122. @Override
  123. public String selfLink() {
  124. return this.inner().selfLink();
  125. }
  126. @Override
  127. public String serverFarmId() {
  128. return this.inner().serverFarmId();
  129. }
  130. @Override
  131. public String siteName() {
  132. return this.inner().siteName();
  133. }
  134. @Override
  135. public String subjectName() {
  136. return this.inner().subjectName();
  137. }
  138. @Override
  139. public String thumbprint() {
  140. return this.inner().thumbprint();
  141. }
  142. @Override
  143. public Boolean valid() {
  144. return this.inner().valid();
  145. }
  146. @Override
  147. public CertificateImpl withPassword(String password) {
  148. this.inner().withPassword(password);
  149. return this;
  150. }
  151. @Override
  152. public CertificateImpl withHostNames(List<String> hostNames) {
  153. if (isInCreateMode()) {
  154. this.inner().withHostNames(hostNames);
  155. } else {
  156. this.updateParameter.withHostNames(hostNames);
  157. }
  158. return this;
  159. }
  160. @Override
  161. public CertificateImpl withKeyVaultId(String keyVaultId) {
  162. if (isInCreateMode()) {
  163. this.inner().withKeyVaultId(keyVaultId);
  164. } else {
  165. this.updateParameter.withKeyVaultId(keyVaultId);
  166. }
  167. return this;
  168. }
  169. @Override
  170. public CertificateImpl withKeyVaultSecretName(String keyVaultSecretName) {
  171. if (isInCreateMode()) {
  172. this.inner().withKeyVaultSecretName(keyVaultSecretName);
  173. } else {
  174. this.updateParameter.withKeyVaultSecretName(keyVaultSecretName);
  175. }
  176. return this;
  177. }
  178. @Override
  179. public CertificateImpl withKind(String kind) {
  180. if (isInCreateMode()) {
  181. this.inner().withKind(kind);
  182. } else {
  183. this.updateParameter.withKind(kind);
  184. }
  185. return this;
  186. }
  187. @Override
  188. public CertificateImpl withPfxBlob(byte[] pfxBlob) {
  189. if (isInCreateMode()) {
  190. this.inner().withPfxBlob(pfxBlob);
  191. } else {
  192. this.updateParameter.withPfxBlob(pfxBlob);
  193. }
  194. return this;
  195. }
  196. @Override
  197. public CertificateImpl withServerFarmId(String serverFarmId) {
  198. if (isInCreateMode()) {
  199. this.inner().withServerFarmId(serverFarmId);
  200. } else {
  201. this.updateParameter.withServerFarmId(serverFarmId);
  202. }
  203. return this;
  204. }
  205. }