From c77daf53c3b3cb1be56c22f3ee4bc6f0b01e8549 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Fri, 13 Dec 2013 15:56:29 +0000 Subject: [PATCH 1/4] Fix META-INF references --- .gitignore | 22 +- ...windowsazure.services.core.Builder$Exports | 9 +- .../resources/management/package-names.xjb | 13 - .../schemas.microsoft.com.windowsazure.xsd | 51 -- .../resources/serviceBus/package-names.xjb | 23 - ...as.microsoft.com.2003.10.Serialization.xsd | 42 -- ...netservices.2010.10.servicebus.connect.xsd | 602 ------------------ ...oft.com.netservices.2011.06.servicebus.xsd | 24 - .../resources/serviceBus/servicebus-atom.xsd | 40 -- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 2 +- ...windowsazure.services.core.Builder$Exports | 4 +- .../com.microsoft.windowsazure.properties | 7 + ...windowsazure.services.core.Builder$Exports | 10 +- .../resources/management/package-names.xjb | 13 - .../schemas.microsoft.com.windowsazure.xsd | 51 -- .../resources/serviceBus/package-names.xjb | 23 - ...as.microsoft.com.2003.10.Serialization.xsd | 42 -- ...netservices.2010.10.servicebus.connect.xsd | 602 ------------------ ...oft.com.netservices.2011.06.servicebus.xsd | 24 - .../resources/serviceBus/servicebus-atom.xsd | 40 -- ...windowsazure.services.core.Builder$Exports | 9 +- .../resources/management/package-names.xjb | 13 - .../schemas.microsoft.com.windowsazure.xsd | 51 -- ...windowsazure.services.core.Builder$Exports | 10 +- .../resources/management/package-names.xjb | 13 - .../schemas.microsoft.com.windowsazure.xsd | 51 -- ...windowsazure.services.core.Builder$Exports | 8 +- 33 files changed, 43 insertions(+), 1768 deletions(-) delete mode 100644 microsoft-azure-api-core/src/main/resources/management/package-names.xjb delete mode 100644 microsoft-azure-api-core/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd delete mode 100644 microsoft-azure-api-core/src/main/resources/serviceBus/package-names.xjb delete mode 100644 microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd delete mode 100644 microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd delete mode 100644 microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd delete mode 100644 microsoft-azure-api-core/src/main/resources/serviceBus/servicebus-atom.xsd create mode 100644 microsoft-azure-api-management/src/test/resources/META-INF/com.microsoft.windowsazure.properties delete mode 100644 microsoft-azure-api-media/src/main/resources/management/package-names.xjb delete mode 100644 microsoft-azure-api-media/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd delete mode 100644 microsoft-azure-api-media/src/main/resources/serviceBus/package-names.xjb delete mode 100644 microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd delete mode 100644 microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd delete mode 100644 microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd delete mode 100644 microsoft-azure-api-media/src/main/resources/serviceBus/servicebus-atom.xsd delete mode 100644 microsoft-azure-api-serviceBus/src/main/resources/management/package-names.xjb delete mode 100644 microsoft-azure-api-serviceBus/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd delete mode 100644 microsoft-azure-api-serviceRuntime/src/main/resources/management/package-names.xjb delete mode 100644 microsoft-azure-api-serviceRuntime/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd diff --git a/.gitignore b/.gitignore index 1760b790d851..9cd833ad2049 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,26 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# Azure Tooling # +node_modules + +# Other Tooling # .classpath .project target -node_modules .idea *.iml + +# Mac OS # +.DS_Store +.DS_Store? + +# Windows # +Thumbs.db \ No newline at end of file diff --git a/microsoft-azure-api-core/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-core/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 7ba2c8c10b49..8bac4933d32e 100644 --- a/microsoft-azure-api-core/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-core/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1,9 +1,2 @@ -com.microsoft.windowsazure.services.blob.Exports -com.microsoft.windowsazure.services.queue.Exports -com.microsoft.windowsazure.services.table.Exports -com.microsoft.windowsazure.services.serviceBus.Exports -com.microsoft.windowsazure.services.serviceBus.implementation.Exports com.microsoft.windowsazure.services.core.utils.Exports -com.microsoft.windowsazure.services.core.utils.pipeline.Exports -com.microsoft.windowsazure.services.media.Exports -com.microsoft.windowsazure.services.management.Exports +com.microsoft.windowsazure.services.core.utils.pipeline.Exports \ No newline at end of file diff --git a/microsoft-azure-api-core/src/main/resources/management/package-names.xjb b/microsoft-azure-api-core/src/main/resources/management/package-names.xjb deleted file mode 100644 index 183b2abd31b3..000000000000 --- a/microsoft-azure-api-core/src/main/resources/management/package-names.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/microsoft-azure-api-core/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd b/microsoft-azure-api-core/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd deleted file mode 100644 index a09632d1c772..000000000000 --- a/microsoft-azure-api-core/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-core/src/main/resources/serviceBus/package-names.xjb b/microsoft-azure-api-core/src/main/resources/serviceBus/package-names.xjb deleted file mode 100644 index 534b69ac71b3..000000000000 --- a/microsoft-azure-api-core/src/main/resources/serviceBus/package-names.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd b/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd deleted file mode 100644 index b4d5ff0f1227..000000000000 --- a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd deleted file mode 100644 index a544e3ecfadb..000000000000 --- a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd b/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd deleted file mode 100644 index b3bf4be77e9f..000000000000 --- a/microsoft-azure-api-core/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-core/src/main/resources/serviceBus/servicebus-atom.xsd b/microsoft-azure-api-core/src/main/resources/serviceBus/servicebus-atom.xsd deleted file mode 100644 index 6b7f6b1eff23..000000000000 --- a/microsoft-azure-api-core/src/main/resources/serviceBus/servicebus-atom.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-management-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..16baa14c5312 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.servicebus.Exports diff --git a/microsoft-azure-api-management-sql/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-sql/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..d77f08cbd8fa 100644 --- a/microsoft-azure-api-management-sql/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-sql/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.sql.Exports diff --git a/microsoft-azure-api-management-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..00f5d8b27dd6 100644 --- a/microsoft-azure-api-management-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.storage.Exports diff --git a/microsoft-azure-api-management-store/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-store/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..457571f8df80 100644 --- a/microsoft-azure-api-management-store/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-store/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.store.Exports diff --git a/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..e26419a469ba 100644 --- a/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.subscriptions.Exports diff --git a/microsoft-azure-api-management-virtualnetwork/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-virtualnetwork/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..4160b6949724 100644 --- a/microsoft-azure-api-management-virtualnetwork/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-virtualnetwork/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.virtualnetworks.Exports diff --git a/microsoft-azure-api-management-website/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-website/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..9d6f8fe4cf4d 100644 --- a/microsoft-azure-api-management-website/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management-website/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.management.websites.Exports diff --git a/microsoft-azure-api-management/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index b13e074da827..a9ab7c465496 100644 --- a/microsoft-azure-api-management/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-management/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1 +1,3 @@ -com.microsoft.windowsazure.management.Exports +com.microsoft.windowsazure.services.core.utils.Exports +com.microsoft.windowsazure.services.core.utils.pipeline.Exports +com.microsoft.windowsazure.management.Exports \ No newline at end of file diff --git a/microsoft-azure-api-management/src/test/resources/META-INF/com.microsoft.windowsazure.properties b/microsoft-azure-api-management/src/test/resources/META-INF/com.microsoft.windowsazure.properties new file mode 100644 index 000000000000..295003ddf9c6 --- /dev/null +++ b/microsoft-azure-api-management/src/test/resources/META-INF/com.microsoft.windowsazure.properties @@ -0,0 +1,7 @@ +management.keystore.path=%MANAGEMENT.KEYSTORE.PATH% +management.keystore.password=%MANAGEMENT.KEYSTORE.PASSWORD% +management.keystore.type=%MANAGEMENT.KEYSTORE.TYPE% +management.subscription.id=%MANAGEMENT.SUBSCRIPTION.ID% +management.uri=%MANAGEMENT.URI% +testprefix.com.microsoft.windowsazure.services.core.Configuration.connectTimeout=3 +testprefix.com.microsoft.windowsazure.services.core.Configuration.readTimeout=7 \ No newline at end of file diff --git a/microsoft-azure-api-media/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-media/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 7ba2c8c10b49..cd0b6a54e15f 100644 --- a/microsoft-azure-api-media/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-media/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1,9 +1 @@ -com.microsoft.windowsazure.services.blob.Exports -com.microsoft.windowsazure.services.queue.Exports -com.microsoft.windowsazure.services.table.Exports -com.microsoft.windowsazure.services.serviceBus.Exports -com.microsoft.windowsazure.services.serviceBus.implementation.Exports -com.microsoft.windowsazure.services.core.utils.Exports -com.microsoft.windowsazure.services.core.utils.pipeline.Exports -com.microsoft.windowsazure.services.media.Exports -com.microsoft.windowsazure.services.management.Exports +com.microsoft.windowsazure.services.media.Exports \ No newline at end of file diff --git a/microsoft-azure-api-media/src/main/resources/management/package-names.xjb b/microsoft-azure-api-media/src/main/resources/management/package-names.xjb deleted file mode 100644 index 183b2abd31b3..000000000000 --- a/microsoft-azure-api-media/src/main/resources/management/package-names.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/microsoft-azure-api-media/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd b/microsoft-azure-api-media/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd deleted file mode 100644 index a09632d1c772..000000000000 --- a/microsoft-azure-api-media/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-media/src/main/resources/serviceBus/package-names.xjb b/microsoft-azure-api-media/src/main/resources/serviceBus/package-names.xjb deleted file mode 100644 index 534b69ac71b3..000000000000 --- a/microsoft-azure-api-media/src/main/resources/serviceBus/package-names.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd b/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd deleted file mode 100644 index b4d5ff0f1227..000000000000 --- a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.2003.10.Serialization.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd deleted file mode 100644 index a544e3ecfadb..000000000000 --- a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd b/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd deleted file mode 100644 index b3bf4be77e9f..000000000000 --- a/microsoft-azure-api-media/src/main/resources/serviceBus/schemas.microsoft.com.netservices.2011.06.servicebus.xsd +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-media/src/main/resources/serviceBus/servicebus-atom.xsd b/microsoft-azure-api-media/src/main/resources/serviceBus/servicebus-atom.xsd deleted file mode 100644 index 6b7f6b1eff23..000000000000 --- a/microsoft-azure-api-media/src/main/resources/serviceBus/servicebus-atom.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 7ba2c8c10b49..c3d42df133dd 100644 --- a/microsoft-azure-api-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-serviceBus/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1,9 +1,2 @@ -com.microsoft.windowsazure.services.blob.Exports -com.microsoft.windowsazure.services.queue.Exports -com.microsoft.windowsazure.services.table.Exports com.microsoft.windowsazure.services.serviceBus.Exports -com.microsoft.windowsazure.services.serviceBus.implementation.Exports -com.microsoft.windowsazure.services.core.utils.Exports -com.microsoft.windowsazure.services.core.utils.pipeline.Exports -com.microsoft.windowsazure.services.media.Exports -com.microsoft.windowsazure.services.management.Exports +com.microsoft.windowsazure.services.serviceBus.implementation.Exports \ No newline at end of file diff --git a/microsoft-azure-api-serviceBus/src/main/resources/management/package-names.xjb b/microsoft-azure-api-serviceBus/src/main/resources/management/package-names.xjb deleted file mode 100644 index 183b2abd31b3..000000000000 --- a/microsoft-azure-api-serviceBus/src/main/resources/management/package-names.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/microsoft-azure-api-serviceBus/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd b/microsoft-azure-api-serviceBus/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd deleted file mode 100644 index a09632d1c772..000000000000 --- a/microsoft-azure-api-serviceBus/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-serviceRuntime/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-serviceRuntime/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 7ba2c8c10b49..faf223aa83eb 100644 --- a/microsoft-azure-api-serviceRuntime/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-serviceRuntime/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1,9 +1 @@ -com.microsoft.windowsazure.services.blob.Exports -com.microsoft.windowsazure.services.queue.Exports -com.microsoft.windowsazure.services.table.Exports -com.microsoft.windowsazure.services.serviceBus.Exports -com.microsoft.windowsazure.services.serviceBus.implementation.Exports -com.microsoft.windowsazure.services.core.utils.Exports -com.microsoft.windowsazure.services.core.utils.pipeline.Exports -com.microsoft.windowsazure.services.media.Exports -com.microsoft.windowsazure.services.management.Exports +com.microsoft.windowsazure.serviceruntime.Exports \ No newline at end of file diff --git a/microsoft-azure-api-serviceRuntime/src/main/resources/management/package-names.xjb b/microsoft-azure-api-serviceRuntime/src/main/resources/management/package-names.xjb deleted file mode 100644 index 183b2abd31b3..000000000000 --- a/microsoft-azure-api-serviceRuntime/src/main/resources/management/package-names.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/microsoft-azure-api-serviceRuntime/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd b/microsoft-azure-api-serviceRuntime/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd deleted file mode 100644 index a09632d1c772..000000000000 --- a/microsoft-azure-api-serviceRuntime/src/main/resources/management/schemas.microsoft.com.windowsazure.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/microsoft-azure-api-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 7ba2c8c10b49..cad7945d7bf9 100644 --- a/microsoft-azure-api-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api-storage/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -1,9 +1,3 @@ com.microsoft.windowsazure.services.blob.Exports com.microsoft.windowsazure.services.queue.Exports -com.microsoft.windowsazure.services.table.Exports -com.microsoft.windowsazure.services.serviceBus.Exports -com.microsoft.windowsazure.services.serviceBus.implementation.Exports -com.microsoft.windowsazure.services.core.utils.Exports -com.microsoft.windowsazure.services.core.utils.pipeline.Exports -com.microsoft.windowsazure.services.media.Exports -com.microsoft.windowsazure.services.management.Exports +com.microsoft.windowsazure.services.table.Exports \ No newline at end of file From 5ffcd152bb31fdd196b3277f7d7126dc4a07e7f1 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Fri, 13 Dec 2013 21:13:48 +0000 Subject: [PATCH 2/4] Update gitignore per review comments --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 9cd833ad2049..1b07ae5c5817 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,22 @@ # Azure Tooling # node_modules +# Eclipse # +*.pydevproject +.project +.metadata +bin/** +tmp/** +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + # Other Tooling # .classpath .project From 8d9c98fd54f5dc6fce9473a59fb8c1d21b954c75 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Sun, 15 Dec 2013 13:17:11 +0100 Subject: [PATCH 3/4] Rename subscription module --- .../org.eclipse.core.resources.prefs | 6 - .../.settings/org.eclipse.jdt.core.prefs | 289 ------------------ .../.settings/org.eclipse.jdt.ui.prefs | 118 ------- .../.settings/org.eclipse.m2e.core.prefs | 5 - ...windowsazure.services.core.Builder$Exports | 1 - microsoft-azure-api-parent/pom.xml | 2 +- .../pom.xml | 2 +- .../src/config/checkstyle.xml | 0 .../windowsazure/subscriptions/Exports.java | 0 .../subscriptions/SubscriptionClient.java | 0 .../subscriptions/SubscriptionClientImpl.java | 0 .../subscriptions/SubscriptionOperations.java | 0 .../SubscriptionOperationsImpl.java | 0 .../subscriptions/SubscriptionService.java | 0 .../SubscriptionListOperationResponse.java | 0 .../models/SubscriptionStatus.java | 0 .../windowsazure/subscriptions/package.html | 0 ...windowsazure.services.core.Builder$Exports | 1 + 18 files changed, 3 insertions(+), 421 deletions(-) delete mode 100644 microsoft-azure-api-management-subscription/.settings/org.eclipse.core.resources.prefs delete mode 100644 microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.core.prefs delete mode 100644 microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.ui.prefs delete mode 100644 microsoft-azure-api-management-subscription/.settings/org.eclipse.m2e.core.prefs delete mode 100644 microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/pom.xml (99%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/config/checkstyle.xml (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/Exports.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClient.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClientImpl.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperations.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperationsImpl.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionService.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionListOperationResponse.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionStatus.java (100%) rename {microsoft-azure-api-management-subscription => microsoft-azure-api-subscription}/src/main/java/com/microsoft/windowsazure/subscriptions/package.html (100%) create mode 100644 microsoft-azure-api-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports diff --git a/microsoft-azure-api-management-subscription/.settings/org.eclipse.core.resources.prefs b/microsoft-azure-api-management-subscription/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf9995641..000000000000 --- a/microsoft-azure-api-management-subscription/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.core.prefs b/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3f7604ef3b69..000000000000 --- a/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,289 +0,0 @@ -#Wed Nov 16 15:46:43 PST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=false -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=false -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=true -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.ui.prefs b/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 1192a0c8bae0..000000000000 --- a/microsoft-azure-api-management-subscription/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,118 +0,0 @@ -#Sat Nov 12 18:37:54 PST 2011 -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=false -cleanup.format_source_code=false -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=false -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=false -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=false -cleanup.use_this_for_non_static_field_access=false -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=false -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=org.eclipse.jdt.ui.default.eclipse_clean_up_profile -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_OneSDK profile -formatter_settings_version=12 -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=1 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/microsoft-azure-api-management-subscription/.settings/org.eclipse.m2e.core.prefs b/microsoft-azure-api-management-subscription/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 55679f3b05ac..000000000000 --- a/microsoft-azure-api-management-subscription/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Oct 18 09:29:27 PDT 2011 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports deleted file mode 100644 index e26419a469ba..000000000000 --- a/microsoft-azure-api-management-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ /dev/null @@ -1 +0,0 @@ -com.microsoft.windowsazure.management.subscriptions.Exports diff --git a/microsoft-azure-api-parent/pom.xml b/microsoft-azure-api-parent/pom.xml index ee719e7f2789..ed14caf9c79a 100644 --- a/microsoft-azure-api-parent/pom.xml +++ b/microsoft-azure-api-parent/pom.xml @@ -324,12 +324,12 @@ ../microsoft-azure-api-management-sql ../microsoft-azure-api-management-storage ../microsoft-azure-api-management-store - ../microsoft-azure-api-management-subscription ../microsoft-azure-api-management-virtualnetwork ../microsoft-azure-api-management-website ../microsoft-azure-api-media ../microsoft-azure-api-serviceBus ../microsoft-azure-api-serviceRuntime ../microsoft-azure-api-storage + ../microsoft-azure-api-subscription diff --git a/microsoft-azure-api-management-subscription/pom.xml b/microsoft-azure-api-subscription/pom.xml similarity index 99% rename from microsoft-azure-api-management-subscription/pom.xml rename to microsoft-azure-api-subscription/pom.xml index ed4b595d6ee0..8640d1ba1f41 100644 --- a/microsoft-azure-api-management-subscription/pom.xml +++ b/microsoft-azure-api-subscription/pom.xml @@ -22,7 +22,7 @@ ../microsoft-azure-api-parent/pom.xml - microsoft-azure-api-management-subscription + microsoft-azure-api-subscription jar Microsoft Windows Azure Subscription Management Client API diff --git a/microsoft-azure-api-management-subscription/src/config/checkstyle.xml b/microsoft-azure-api-subscription/src/config/checkstyle.xml similarity index 100% rename from microsoft-azure-api-management-subscription/src/config/checkstyle.xml rename to microsoft-azure-api-subscription/src/config/checkstyle.xml diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/Exports.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/Exports.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/Exports.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/Exports.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClient.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClient.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClient.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClient.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClientImpl.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClientImpl.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClientImpl.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionClientImpl.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperations.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperations.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperations.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperations.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperationsImpl.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperationsImpl.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperationsImpl.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionOperationsImpl.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionService.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionService.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionService.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/SubscriptionService.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionListOperationResponse.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionListOperationResponse.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionListOperationResponse.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionListOperationResponse.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionStatus.java b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionStatus.java similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionStatus.java rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/models/SubscriptionStatus.java diff --git a/microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/package.html b/microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/package.html similarity index 100% rename from microsoft-azure-api-management-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/package.html rename to microsoft-azure-api-subscription/src/main/java/com/microsoft/windowsazure/subscriptions/package.html diff --git a/microsoft-azure-api-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports new file mode 100644 index 000000000000..3a725b8b65fc --- /dev/null +++ b/microsoft-azure-api-subscription/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -0,0 +1 @@ +com.microsoft.windowsazure.subscriptions.Exports From c624d5ab5f21036accc40a1bba5552e2d0588189 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Sun, 15 Dec 2013 13:42:23 +0100 Subject: [PATCH 4/4] Add scheduler module --- .../services/core/ServiceException.java | 14 + .../services/core/TimeSpan8601Converter.java | 38 + .../core/TimeSpan8601ConverterTests.java | 43 + .../compute/DeploymentOperationsImpl.java | 12 +- .../compute/HostedServiceOperationsImpl.java | 6 +- .../VirtualMachineImageOperationsImpl.java | 17 +- .../compute/models/AccessControlListRule.java | 1 - ...mentRollbackUpdateOrUpgradeParameters.java | 1 - .../DeploymentUpdateStatusParameters.java | 1 - .../compute/models/DomainJoinSettings.java | 1 - .../compute/models/LoadBalancerProbe.java | 1 - .../ServiceCertificateCreateParameters.java | 1 - .../compute/models/UpgradeStatus.java | 1 - .../VirtualMachineCaptureParameters.java | 1 - .../VirtualMachineShutdownParameters.java | 1 - .../WindowsRemoteManagementListener.java | 1 - .../pom.xml | 260 ++ .../src/config/checkstyle.xml | 240 + .../monitoring/alerts/AlertsClient.java | 53 + .../monitoring/alerts/AlertsClientImpl.java | 128 + .../monitoring/alerts/AlertsService.java | 70 + .../management/monitoring/alerts/Exports.java | 33 + .../monitoring/alerts/IncidentOperations.java | 77 + .../alerts/IncidentOperationsImpl.java | 450 ++ .../monitoring/alerts/RuleOperations.java | 96 + .../monitoring/alerts/RuleOperationsImpl.java | 776 ++++ .../monitoring/alerts/models/Incident.java | 100 + .../alerts/models/IncidentCollection.java | 51 + .../alerts/models/IncidentGetResponse.java | 50 + .../alerts/models/IncidentListResponse.java | 50 + .../monitoring/alerts/models/Rule.java | 124 + .../monitoring/alerts/models/RuleAction.java | 36 + .../alerts/models/RuleCollection.java | 51 + .../alerts/models/RuleCondition.java | 36 + .../models/RuleCreateOrUpdateParameters.java | 48 + .../alerts/models/RuleDataSource.java | 36 + .../alerts/models/RuleEmailAction.java | 63 + .../alerts/models/RuleGetResponse.java | 50 + .../alerts/models/RuleListResponse.java | 50 + .../alerts/models/RuleMetricDataSource.java | 72 + .../alerts/models/ThresholdRuleCondition.java | 86 + .../management/monitoring/alerts/package.html | 6 + .../monitoring/autoscale/AutoscaleClient.java | 48 + .../autoscale/AutoscaleClientImpl.java | 120 + .../autoscale/AutoscaleService.java | 70 + .../monitoring/autoscale/Exports.java | 34 + .../autoscale/SettingOperations.java | 79 + .../autoscale/SettingOperationsImpl.java | 800 ++++ .../autoscale/models/AutoscaleProfile.java | 105 + .../autoscale/models/AutoscaleSetting.java | 63 + ...oscaleSettingCreateOrUpdateParameters.java | 49 + .../models/AutoscaleSettingGetResponse.java | 44 + .../models/ComparisonOperationType.java | 37 + .../autoscale/models/MetricStatisticType.java | 33 + .../autoscale/models/MetricTrigger.java | 144 + .../autoscale/models/Recurrence.java | 45 + .../autoscale/models/RecurrenceFrequency.java | 65 + .../autoscale/models/RecurrentSchedule.java | 62 + .../autoscale/models/ScaleAction.java | 84 + .../autoscale/models/ScaleCapacity.java | 72 + .../autoscale/models/ScaleDirection.java | 40 + .../autoscale/models/ScaleRule.java | 60 + .../autoscale/models/ScaleType.java | 45 + .../autoscale/models/TimeAggregationType.java | 37 + .../autoscale/models/TimeWindow.java | 74 + .../monitoring/autoscale/package.html | 6 + .../monitoring/metrics/Exports.java | 33 + .../metrics/MetricDefinitionOperations.java | 55 + .../MetricDefinitionOperationsImpl.java | 259 ++ .../metrics/MetricSettingOperations.java | 75 + .../metrics/MetricSettingOperationsImpl.java | 535 +++ .../metrics/MetricValueOperations.java | 63 + .../metrics/MetricValueOperationsImpl.java | 329 ++ .../monitoring/metrics/MetricsClient.java | 44 + .../monitoring/metrics/MetricsClientImpl.java | 112 + .../monitoring/metrics/MetricsService.java | 70 + .../AvailabilityMetricSettingValue.java | 90 + .../metrics/models/EndpointConfig.java | 98 + .../metrics/models/MetricAvailability.java | 62 + .../metrics/models/MetricDefinition.java | 148 + .../models/MetricDefinitionCollection.java | 51 + .../models/MetricDefinitionListResponse.java | 50 + .../metrics/models/MetricSetting.java | 72 + .../models/MetricSettingCollection.java | 51 + .../models/MetricSettingListResponse.java | 50 + .../metrics/models/MetricSettingValue.java | 36 + .../models/MetricSettingsPutParameters.java | 48 + .../metrics/models/MetricValue.java | 122 + .../models/MetricValueListResponse.java | 50 + .../metrics/models/MetricValueSet.java | 149 + .../models/MetricValueSetCollection.java | 51 + .../monitoring/metrics/models/NameConfig.java | 60 + .../monitoring/metrics/package.html | 6 + ...windowsazure.services.core.Builder$Exports | 1 + .../pom.xml | 260 ++ .../src/config/checkstyle.xml | 240 + .../management/scheduler/Exports.java | 33 + .../scheduler/JobCollectionOperations.java | 267 ++ .../JobCollectionOperationsImpl.java | 1099 +++++ .../scheduler/SchedulerManagementClient.java | 136 + .../SchedulerManagementClientImpl.java | 479 ++ .../scheduler/SchedulerManagementService.java | 70 + ...llectionCheckNameAvailabilityResponse.java | 51 + .../models/JobCollectionCreateParameters.java | 76 + .../models/JobCollectionCreateResponse.java | 50 + .../models/JobCollectionGetResponse.java | 265 ++ .../JobCollectionIntrinsicSettings.java | 60 + .../models/JobCollectionMaxRecurrence.java | 59 + .../scheduler/models/JobCollectionPlan.java | 29 + .../scheduler/models/JobCollectionQuota.java | 73 + .../JobCollectionRecurrenceFrequency.java | 41 + .../scheduler/models/JobCollectionState.java | 56 + .../models/JobCollectionUpdateParameters.java | 90 + .../models/JobCollectionUpdateResponse.java | 50 + ...ResourceProviderGetPropertiesResponse.java | 47 + .../models/SchedulerOperationStatus.java | 43 + .../SchedulerOperationStatusResponse.java | 155 + .../management/scheduler/package.html | 6 + ...windowsazure.services.core.Builder$Exports | 1 + .../serviceBus/NamespaceOperationsImpl.java | 127 +- .../NotificationHubOperationsImpl.java | 33 +- .../serviceBus/QueueOperationsImpl.java | 136 +- .../serviceBus/RelayOperationsImpl.java | 11 +- .../ServiceBusManagementClientImpl.java | 22 +- .../serviceBus/TopicOperationsImpl.java | 136 +- .../management/sql/DacOperationsImpl.java | 33 +- .../sql/DatabaseOperationOperationsImpl.java | 33 +- .../sql/DatabaseOperationsImpl.java | 59 +- .../sql/FirewallRuleOperationsImpl.java | 48 +- .../management/sql/ServerOperationsImpl.java | 48 +- .../sql/ServiceObjectiveOperationsImpl.java | 22 +- .../AffinityGroupOperationsImpl.java | 61 +- .../management/LocationOperationsImpl.java | 11 +- .../ManagementCertificateOperationsImpl.java | 48 +- .../management/ManagementClientImpl.java | 11 +- .../SubscriptionOperationsImpl.java | 44 +- microsoft-azure-api-parent/pom.xml | 3 + microsoft-azure-api-scheduler/pom.xml | 260 ++ .../src/config/checkstyle.xml | 240 + .../windowsazure/scheduler/Exports.java | 33 + .../windowsazure/scheduler/JobOperations.java | 200 + .../scheduler/JobOperationsImpl.java | 4050 +++++++++++++++++ .../scheduler/SchedulerClient.java | 38 + .../scheduler/SchedulerClientImpl.java | 412 ++ .../scheduler/SchedulerService.java | 70 + .../windowsazure/scheduler/models/Job.java | 110 + .../scheduler/models/JobAction.java | 96 + .../scheduler/models/JobActionType.java | 34 + ...obCollectionJobsUpdateStateParameters.java | 43 + .../JobCollectionJobsUpdateStateResponse.java | 63 + .../models/JobCreateOrUpdateParameters.java | 74 + .../models/JobCreateOrUpdateResponse.java | 50 + .../scheduler/models/JobCreateParameters.java | 74 + .../scheduler/models/JobCreateResponse.java | 50 + .../scheduler/models/JobErrorAction.java | 72 + .../models/JobGetHistoryParameters.java | 80 + .../models/JobGetHistoryResponse.java | 116 + .../scheduler/models/JobGetResponse.java | 50 + .../scheduler/models/JobHttpRequest.java | 88 + .../scheduler/models/JobListParameters.java | 80 + .../scheduler/models/JobListResponse.java | 62 + .../scheduler/models/JobQueueMessage.java | 84 + .../scheduler/models/JobRecurrence.java | 100 + .../models/JobRecurrenceFrequency.java | 41 + .../models/JobRecurrenceSchedule.java | 118 + .../scheduler/models/JobScheduleDay.java | 42 + .../models/JobScheduleMonthlyOccurrence.java | 62 + .../scheduler/models/JobState.java | 33 + .../scheduler/models/JobStatus.java | 104 + .../models/JobUpdateStateParameters.java | 48 + .../models/JobUpdateStateResponse.java | 50 + .../scheduler/models/RetryPolicy.java | 74 + .../scheduler/models/RetryType.java | 32 + .../windowsazure/scheduler/package.html | 6 + ...windowsazure.services.core.Builder$Exports | 1 + 175 files changed, 19666 insertions(+), 414 deletions(-) create mode 100644 microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/TimeSpan8601Converter.java create mode 100644 microsoft-azure-api-core/src/test/java/com/microsoft/windowsazure/services/core/TimeSpan8601ConverterTests.java create mode 100644 microsoft-azure-api-management-monitoring/pom.xml create mode 100644 microsoft-azure-api-management-monitoring/src/config/checkstyle.xml create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClient.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClientImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsService.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/Exports.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Incident.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentCollection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentGetResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentListResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Rule.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleAction.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCollection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCondition.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCreateOrUpdateParameters.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleDataSource.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleEmailAction.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleGetResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleListResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleMetricDataSource.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/ThresholdRuleCondition.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/package.html create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClient.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClientImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleService.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/Exports.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleProfile.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSetting.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingCreateOrUpdateParameters.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingGetResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ComparisonOperationType.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricStatisticType.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricTrigger.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/Recurrence.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrenceFrequency.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrentSchedule.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleAction.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleCapacity.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleDirection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleRule.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleType.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeAggregationType.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeWindow.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/package.html create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/Exports.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperations.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperationsImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClient.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClientImpl.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsService.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/AvailabilityMetricSettingValue.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/EndpointConfig.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricAvailability.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinition.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionCollection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionListResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSetting.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingCollection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingListResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingValue.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingsPutParameters.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValue.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueListResponse.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSet.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSetCollection.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/NameConfig.java create mode 100644 microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/package.html create mode 100644 microsoft-azure-api-management-monitoring/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports create mode 100644 microsoft-azure-api-management-scheduler/pom.xml create mode 100644 microsoft-azure-api-management-scheduler/src/config/checkstyle.xml create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/Exports.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperations.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperationsImpl.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClient.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClientImpl.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementService.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCheckNameAvailabilityResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateParameters.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionGetResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionIntrinsicSettings.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionMaxRecurrence.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionPlan.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionQuota.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionRecurrenceFrequency.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionState.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateParameters.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/ResourceProviderGetPropertiesResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatus.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatusResponse.java create mode 100644 microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/package.html create mode 100644 microsoft-azure-api-management-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports create mode 100644 microsoft-azure-api-scheduler/pom.xml create mode 100644 microsoft-azure-api-scheduler/src/config/checkstyle.xml create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/Exports.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperations.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperationsImpl.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClient.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClientImpl.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerService.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/Job.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobAction.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobActionType.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobErrorAction.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobHttpRequest.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobQueueMessage.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrence.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceFrequency.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceSchedule.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleDay.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleMonthlyOccurrence.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobState.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobStatus.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateParameters.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateResponse.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryPolicy.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryType.java create mode 100644 microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/package.html create mode 100644 microsoft-azure-api-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports diff --git a/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java b/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java index ec896ce973ef..4eb8fe6253d8 100644 --- a/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java +++ b/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java @@ -133,6 +133,20 @@ public String getRawResponseBody() { public static ServiceException createFromXml(HttpRequest httpRequest, String requestContent, HttpResponse httpResponse, HttpEntity entity) { try { + // TODO: actually implement this + ServiceException serviceException = new ServiceException(); + serviceException.setErrorMessage(EntityUtils.toString(entity)); + return serviceException; + } + catch (IOException e) { + return new ServiceException(); + } + } + + public static ServiceException createFromJson(HttpRequest httpRequest, String requestContent, HttpResponse httpResponse, HttpEntity entity) + { + try { + // TODO: actually implement this ServiceException serviceException = new ServiceException(); serviceException.setErrorMessage(EntityUtils.toString(entity)); return serviceException; diff --git a/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/TimeSpan8601Converter.java b/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/TimeSpan8601Converter.java new file mode 100644 index 000000000000..3b5d93b7531b --- /dev/null +++ b/microsoft-azure-api-core/src/main/java/com/microsoft/windowsazure/services/core/TimeSpan8601Converter.java @@ -0,0 +1,38 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.core; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; + +public class TimeSpan8601Converter { + public static String format(Duration duration) { + return duration.toString(); + } + + public static Duration parse(String duration) { + try { + DatatypeFactory factory = DatatypeFactory.newInstance(); + return factory.newDuration(duration); + } + catch (DatatypeConfigurationException e) + { + String msg = String.format("The value \"%s\" is not a valid ISO8601 duration.", duration); + throw new IllegalArgumentException(msg, e); + } + } +} diff --git a/microsoft-azure-api-core/src/test/java/com/microsoft/windowsazure/services/core/TimeSpan8601ConverterTests.java b/microsoft-azure-api-core/src/test/java/com/microsoft/windowsazure/services/core/TimeSpan8601ConverterTests.java new file mode 100644 index 000000000000..74968d11c219 --- /dev/null +++ b/microsoft-azure-api-core/src/test/java/com/microsoft/windowsazure/services/core/TimeSpan8601ConverterTests.java @@ -0,0 +1,43 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.core; + +import static org.junit.Assert.*; + +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; +import org.junit.Test; + +public class TimeSpan8601ConverterTests { + @Test + public void formatShouldWork() throws Exception { + DatatypeFactory dataTypeFactory = DatatypeFactory.newInstance(); + Duration duration = dataTypeFactory.newDurationDayTime(true, 0, 3, 10, 2); + String durationString = TimeSpan8601Converter.format(duration); + + assertEquals("P0DT3H10M2S", durationString); + } + + @Test + public void parseShouldWork() throws Exception { + Duration duration = TimeSpan8601Converter.parse("P0DT3H10M2S"); + + assertEquals(0, duration.getDays()); + assertEquals(3, duration.getHours()); + assertEquals(10, duration.getMinutes()); + assertEquals(2, duration.getSeconds()); + } +} diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/DeploymentOperationsImpl.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/DeploymentOperationsImpl.java index 00d0e25345c6..7d171f52ef6b 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/DeploymentOperationsImpl.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/DeploymentOperationsImpl.java @@ -81,7 +81,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Map.Entry; +import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -270,7 +270,7 @@ public OperationResponse beginChangingConfigurationByName(String serviceName, St if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); @@ -505,7 +505,7 @@ public OperationResponse beginChangingConfigurationBySlot(String serviceName, De if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); @@ -764,7 +764,7 @@ public OperationResponse beginCreating(String serviceName, DeploymentSlot deploy if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); @@ -1977,7 +1977,7 @@ public OperationResponse beginUpgradingByName(String serviceName, String deploym if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); @@ -2271,7 +2271,7 @@ public OperationResponse beginUpgradingBySlot(String serviceName, DeploymentSlot if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/HostedServiceOperationsImpl.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/HostedServiceOperationsImpl.java index 9a34869792cb..03307772c4f7 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/HostedServiceOperationsImpl.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/HostedServiceOperationsImpl.java @@ -83,7 +83,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Map.Entry; +import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -675,7 +675,7 @@ public OperationResponse create(HostedServiceCreateParameters parameters) throws if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); @@ -3240,7 +3240,7 @@ public OperationResponse update(String serviceName, HostedServiceUpdateParameter if (parameters.getExtendedProperties() != null) { Element extendedPropertiesDictionaryElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "ExtendedProperties"); - for (Entry entry : parameters.getExtendedProperties().entrySet()) + for (Map.Entry entry : parameters.getExtendedProperties().entrySet()) { String extendedPropertiesKey = entry.getKey(); String extendedPropertiesValue = entry.getValue(); diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/VirtualMachineImageOperationsImpl.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/VirtualMachineImageOperationsImpl.java index 6dd477dc9846..11f7dfacf178 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/VirtualMachineImageOperationsImpl.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/VirtualMachineImageOperationsImpl.java @@ -42,6 +42,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.TimeZone; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -210,7 +211,9 @@ public VirtualMachineImageCreateResponse create(VirtualMachineImageCreateParamet if (parameters.getPublishedDate() != null) { Element publishedDateElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "PublishedDate"); - publishedDateElement.appendChild(requestDoc.createTextNode(parameters.getPublishedDate().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + publishedDateElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(parameters.getPublishedDate().getTime()))); oSImageElement.appendChild(publishedDateElement); } @@ -386,9 +389,9 @@ public VirtualMachineImageCreateResponse create(VirtualMachineImageCreateParamet if (publishedDateElement2 != null && (publishedDateElement2.getTextContent() != null && publishedDateElement2.getTextContent().isEmpty() != true) == false) { Calendar publishedDateInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(publishedDateElement2.getTextContent())); + calendar.setTime(simpleDateFormat2.parse(publishedDateElement2.getTextContent())); publishedDateInstance = calendar; result.setPublishedDate(publishedDateInstance); } @@ -1183,7 +1186,9 @@ public VirtualMachineImageUpdateResponse update(String imageName, VirtualMachine if (parameters.getPublishedDate() != null) { Element publishedDateElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "PublishedDate"); - publishedDateElement.appendChild(requestDoc.createTextNode(parameters.getPublishedDate().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + publishedDateElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(parameters.getPublishedDate().getTime()))); oSImageElement.appendChild(publishedDateElement); } @@ -1355,9 +1360,9 @@ public VirtualMachineImageUpdateResponse update(String imageName, VirtualMachine if (publishedDateElement2 != null && (publishedDateElement2.getTextContent() != null && publishedDateElement2.getTextContent().isEmpty() != true) == false) { Calendar publishedDateInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(publishedDateElement2.getTextContent())); + calendar.setTime(simpleDateFormat2.parse(publishedDateElement2.getTextContent())); publishedDateInstance = calendar; result.setPublishedDate(publishedDateInstance); } diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/AccessControlListRule.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/AccessControlListRule.java index 3370489b0af7..b30f756e193e 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/AccessControlListRule.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/AccessControlListRule.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * An access control rule for a public endpoint */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentRollbackUpdateOrUpgradeParameters.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentRollbackUpdateOrUpgradeParameters.java index ab25bc6b2424..456a5834edeb 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentRollbackUpdateOrUpgradeParameters.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentRollbackUpdateOrUpgradeParameters.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Parameters supplied to the Rollback Update Or Upgrade operation. */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentUpdateStatusParameters.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentUpdateStatusParameters.java index ca02c2b28085..3397d72fe9ae 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentUpdateStatusParameters.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DeploymentUpdateStatusParameters.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Parameters supplied to the Update Deployment Status operation. */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DomainJoinSettings.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DomainJoinSettings.java index 1186e5d49c0d..04b7c9c3d711 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DomainJoinSettings.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/DomainJoinSettings.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Optional. Contains properties that specify a domain to which the virtual * machine will be joined. This element is only used with the diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/LoadBalancerProbe.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/LoadBalancerProbe.java index 653be390deb9..f59337e47db0 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/LoadBalancerProbe.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/LoadBalancerProbe.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Contains properties that specify the endpoint settings which the Windows * Azure load balancer uses to monitor the availability of this virtual machine diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/ServiceCertificateCreateParameters.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/ServiceCertificateCreateParameters.java index 31dc69b10039..762e4ddbd6bd 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/ServiceCertificateCreateParameters.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/ServiceCertificateCreateParameters.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Parameters supplied to the Create Service Certificate operation. */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/UpgradeStatus.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/UpgradeStatus.java index f86b6afc4d22..f03a1ce1c134 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/UpgradeStatus.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/UpgradeStatus.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Contains upgrade details of the deployment. */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineCaptureParameters.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineCaptureParameters.java index 1675f62a3bf0..15e2b7a83625 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineCaptureParameters.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineCaptureParameters.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Parameters supplied to the Capture Virtual Machine operation. */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineShutdownParameters.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineShutdownParameters.java index 46fc0061b02d..8e8af31d239b 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineShutdownParameters.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/VirtualMachineShutdownParameters.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * The parameters required for shutting down the virtual machine */ diff --git a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/WindowsRemoteManagementListener.java b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/WindowsRemoteManagementListener.java index 50308dd79ffd..f57a7f2cea62 100644 --- a/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/WindowsRemoteManagementListener.java +++ b/microsoft-azure-api-management-compute/src/main/java/com/microsoft/windowsazure/management/compute/models/WindowsRemoteManagementListener.java @@ -21,7 +21,6 @@ package com.microsoft.windowsazure.management.compute.models; - /** * Contains the type and certificate information for the listener. */ diff --git a/microsoft-azure-api-management-monitoring/pom.xml b/microsoft-azure-api-management-monitoring/pom.xml new file mode 100644 index 000000000000..2b38edef81a3 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/pom.xml @@ -0,0 +1,260 @@ + + + 4.0.0 + + com.microsoft.windowsazure + microsoft-azure-api-parent + 0.4.6 + ../microsoft-azure-api-parent/pom.xml + + + microsoft-azure-api-management-monitoring + jar + + Microsoft Windows Azure Monitoring Management Client API + Windows Azure Monitoring Management SDK Clients + https://github.com/WindowsAzure/azure-sdk-for-java + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + scm:git:https://github.com/WindowsAzure/azure-sdk-for-java + scm:git:git://github.com/WindowsAzure/azure-sdk-for-java.git + + + + UTF-8 + + + 2.1.1 + 3.0.7.RELEASE + + + + + microsoft + Microsoft + + + + + + ${project.groupId} + microsoft-azure-api-core + 0.4.6 + + + commons-logging + commons-logging + + + commons-codec + commons-codec + 1.2 + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + + com.sun.jersey + jersey-client + + + javax.xml.bind + jaxb-api + provided + + + junit + junit + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-all + test + + + javax.inject + javax.inject + + + com.sun.jersey + jersey-json + + + javax.mail + mail + + + org.bouncycastle + bcprov-jdk16 + test + + + + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + validate + + evaluate + + + legal + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.8.3 + + + serviceBus + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/serviceBus + + servicebus-atom.xsd + + com.microsoft.windowsazure.services.serviceBus.implementation + false + true + + + + management + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/management/ + + schemas.microsoft.com.windowsazure.xsd + + com.microsoft.windowsazure.services.management.implementation + false + true + + + + + true + true + true + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.6.4 + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.4 + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright Microsoft Corporation +
* +
* 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. +
*/]]>
+
+
+ + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + true + true + true + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.8 + + src/config/checkstyle.xml + + + +
+
+
diff --git a/microsoft-azure-api-management-monitoring/src/config/checkstyle.xml b/microsoft-azure-api-management-monitoring/src/config/checkstyle.xml new file mode 100644 index 000000000000..58a40f4ac43a --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/config/checkstyle.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClient.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClient.java new file mode 100644 index 000000000000..8ff6ed8062d4 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClient.java @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import java.net.URI; + +public interface AlertsClient +{ + /** + * Optional base uri parameter for Azure REST. + */ + URI getBaseUri(); + + /** + * When you create a Windows Azure subscription, it is uniquely identified + * by a subscription ID. The subscription ID forms part of the URI for + * every call that you make to the Service Management API. The Windows + * Azure Service ManagementAPI use mutual authentication of management + * certificates over SSL to ensure that a request made to the service is + * secure. No anonymous requests are allowed. + */ + SubscriptionCloudCredentials getCredentials(); + + /** + * Operations for managing the alert incidents. + */ + IncidentOperations getIncidents(); + + /** + * Operations for managing the alert rules. + */ + RuleOperations getRules(); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClientImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClientImpl.java new file mode 100644 index 000000000000..66405e735154 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsClientImpl.java @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.ManagementConfiguration; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.services.core.ServiceClient; +import java.net.URI; +import javax.inject.Inject; +import javax.inject.Named; + +public class AlertsClientImpl extends ServiceClient implements AlertsClient +{ + private URI baseUri; + + /** + * Optional base uri parameter for Azure REST. + */ + public URI getBaseUri() { return this.baseUri; } + + private SubscriptionCloudCredentials credentials; + + /** + * When you create a Windows Azure subscription, it is uniquely identified + * by a subscription ID. The subscription ID forms part of the URI for + * every call that you make to the Service Management API. The Windows + * Azure Service ManagementAPI use mutual authentication of management + * certificates over SSL to ensure that a request made to the service is + * secure. No anonymous requests are allowed. + */ + public SubscriptionCloudCredentials getCredentials() { return this.credentials; } + + private IncidentOperations incidents; + + /** + * Operations for managing the alert incidents. + */ + public IncidentOperations getIncidents() { return this.incidents; } + + private RuleOperations rules; + + /** + * Operations for managing the alert rules. + */ + public RuleOperations getRules() { return this.rules; } + + /** + * Initializes a new instance of the AlertsClientImpl class. + * + */ + private AlertsClientImpl() + { + super(); + this.incidents = new IncidentOperationsImpl(this); + this.rules = new RuleOperationsImpl(this); + } + + /** + * Initializes a new instance of the AlertsClientImpl class. + * + * @param credentials When you create a Windows Azure subscription, it is + * uniquely identified by a subscription ID. The subscription ID forms part + * of the URI for every call that you make to the Service Management API. + * The Windows Azure Service ManagementAPI use mutual authentication of + * management certificates over SSL to ensure that a request made to the + * service is secure. No anonymous requests are allowed. + * @param baseUri Optional base uri parameter for Azure REST. + */ + public AlertsClientImpl(SubscriptionCloudCredentials credentials, URI baseUri) + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (baseUri == null) + { + throw new NullPointerException("baseUri"); + } + this.credentials = credentials; + this.baseUri = baseUri; + + httpClient = credentials.initializeClient(); + } + + /** + * Initializes a new instance of the AlertsClientImpl class. + * + * @param credentials When you create a Windows Azure subscription, it is + * uniquely identified by a subscription ID. The subscription ID forms part + * of the URI for every call that you make to the Service Management API. + * The Windows Azure Service ManagementAPI use mutual authentication of + * management certificates over SSL to ensure that a request made to the + * service is secure. No anonymous requests are allowed. + */ + @Inject + public AlertsClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CREDENTIALS) SubscriptionCloudCredentials credentials) throws java.net.URISyntaxException + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + this.credentials = credentials; + this.baseUri = new URI("https://management.core.windows.net"); + + httpClient = credentials.initializeClient(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsService.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsService.java new file mode 100644 index 000000000000..51187b953944 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/AlertsService.java @@ -0,0 +1,70 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access service management functionality. + * + */ +public class AlertsService { + + private AlertsService() { + // class is not instantiated + } + + /** + * Creates an instance of the AlertsClient API. + * + */ + public static AlertsClient create() { + return Configuration.getInstance().create(AlertsClient.class); + } + + /** + * Creates an instance of the AlertsClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static AlertsClient create(Configuration config) { + return config.create(AlertsClient.class); + } + + /** + * Creates an instance of the AlertsClient API. + * + * @param profile + * A String object that representing the profile of the service management service. + * + */ + public static AlertsClient create(String profile) { + return Configuration.getInstance().create(profile, AlertsClient.class); + } + + /** + * Creates an instance of the AlertsClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static AlertsClient create(String profile, Configuration config) { + return config.create(profile, AlertsClient.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/Exports.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/Exports.java new file mode 100644 index 000000000000..ccaf2e1ceb89 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/Exports.java @@ -0,0 +1,33 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.services.core.Builder; + +/** + * The Class Exports. + */ +public class Exports implements Builder.Exports { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.Builder.Exports#register(com.microsoft.windowsazure.services.core.Builder.Registry) + */ + @Override + public void register(Builder.Registry registry) { + + // provide contract implementation + registry.add(AlertsClient.class, AlertsClientImpl.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperations.java new file mode 100644 index 000000000000..fc229eefa7ca --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperations.java @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.monitoring.alerts.models.IncidentGetResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.IncidentListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.text.ParseException; +import java.util.concurrent.Future; + +/** +* Operations for managing the alert incidents. +*/ +public interface IncidentOperations +{ + /** + * + * @param incidentId The id of the incident to retrieve. + * @return The Get Incident operation response. + */ + IncidentGetResponse get(String incidentId) throws IOException, ServiceException, ParseException; + + /** + * + * @param incidentId The id of the incident to retrieve. + * @return The Get Incident operation response. + */ + Future getAsync(String incidentId); + + /** + * + * @return The List incidents operation response. + */ + IncidentListResponse listActiveForSubscription() throws IOException, ServiceException, ParseException; + + /** + * + * @return The List incidents operation response. + */ + Future listActiveForSubscriptionAsync(); + + /** + * + * @param ruleId The rule id. + * @param isActive A boolean to retrieve only active or resolved incidents. + * @return The List incidents operation response. + */ + IncidentListResponse listForRule(String ruleId, boolean isActive) throws IOException, ServiceException, ParseException; + + /** + * + * @param ruleId The rule id. + * @param isActive A boolean to retrieve only active or resolved incidents. + * @return The List incidents operation response. + */ + Future listForRuleAsync(String ruleId, boolean isActive); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperationsImpl.java new file mode 100644 index 000000000000..05fd1b4e3dc0 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/IncidentOperationsImpl.java @@ -0,0 +1,450 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.monitoring.alerts.models.Incident; +import com.microsoft.windowsazure.management.monitoring.alerts.models.IncidentCollection; +import com.microsoft.windowsazure.management.monitoring.alerts.models.IncidentGetResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.IncidentListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import java.io.IOException; +import java.io.InputStream; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; + +/** +* Operations for managing the alert incidents. +*/ +public class IncidentOperationsImpl implements ServiceOperations, IncidentOperations +{ + /** + * Initializes a new instance of the IncidentOperationsImpl class. + * + * @param client Reference to the service client. + */ + IncidentOperationsImpl(AlertsClientImpl client) + { + this.client = client; + } + + private AlertsClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.alerts.AlertsClientImpl. + */ + public AlertsClientImpl getClient() { return this.client; } + + /** + * + * @param incidentId The id of the incident to retrieve. + * @return The Get Incident operation response. + */ + @Override + public Future getAsync(final String incidentId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public IncidentGetResponse call() throws Exception + { + return get(incidentId); + } + }); + } + + /** + * + * @param incidentId The id of the incident to retrieve. + * @return The Get Incident operation response. + */ + @Override + public IncidentGetResponse get(String incidentId) throws IOException, ServiceException, ParseException + { + // Validate + if (incidentId == null) + { + throw new NullPointerException("incidentId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertincidents/" + incidentId; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + IncidentGetResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new IncidentGetResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Incident incidentInstance = new Incident(); + result.setIncident(incidentInstance); + + JsonNode idValue = responseDoc.get("Id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + incidentInstance.setId(idInstance); + } + + JsonNode ruleIdValue = responseDoc.get("RuleId"); + if (ruleIdValue != null) + { + String ruleIdInstance; + ruleIdInstance = ruleIdValue.getTextValue(); + incidentInstance.setRuleId(ruleIdInstance); + } + + JsonNode isActiveValue = responseDoc.get("IsActive"); + if (isActiveValue != null) + { + boolean isActiveInstance; + isActiveInstance = isActiveValue.getBooleanValue(); + incidentInstance.setIsActive(isActiveInstance); + } + + JsonNode activatedTimeValue = responseDoc.get("ActivatedTime"); + if (activatedTimeValue != null) + { + Calendar activatedTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(activatedTimeValue.getTextValue())); + activatedTimeInstance = calendar; + incidentInstance.setActivatedTime(activatedTimeInstance); + } + + JsonNode resolvedTimeValue = responseDoc.get("ResolvedTime"); + if (resolvedTimeValue != null) + { + Calendar resolvedTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(resolvedTimeValue.getTextValue())); + resolvedTimeInstance = calendar2; + incidentInstance.setResolvedTime(resolvedTimeInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @return The List incidents operation response. + */ + @Override + public Future listActiveForSubscriptionAsync() + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public IncidentListResponse call() throws Exception + { + return listActiveForSubscription(); + } + }); + } + + /** + * + * @return The List incidents operation response. + */ + @Override + public IncidentListResponse listActiveForSubscription() throws IOException, ServiceException, ParseException + { + // Validate + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertincidents?$filter=IsActive eq true"; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + IncidentListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new IncidentListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + IncidentCollection incidentCollectionInstance = new IncidentCollection(); + result.setIncidentCollection(incidentCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + Incident incidentInstance = new Incident(); + incidentCollectionInstance.getValue().add(incidentInstance); + + JsonNode idValue = valueValue.get("Id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + incidentInstance.setId(idInstance); + } + + JsonNode ruleIdValue = valueValue.get("RuleId"); + if (ruleIdValue != null) + { + String ruleIdInstance; + ruleIdInstance = ruleIdValue.getTextValue(); + incidentInstance.setRuleId(ruleIdInstance); + } + + JsonNode isActiveValue = valueValue.get("IsActive"); + if (isActiveValue != null) + { + boolean isActiveInstance; + isActiveInstance = isActiveValue.getBooleanValue(); + incidentInstance.setIsActive(isActiveInstance); + } + + JsonNode activatedTimeValue = valueValue.get("ActivatedTime"); + if (activatedTimeValue != null) + { + Calendar activatedTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(activatedTimeValue.getTextValue())); + activatedTimeInstance = calendar; + incidentInstance.setActivatedTime(activatedTimeInstance); + } + + JsonNode resolvedTimeValue = valueValue.get("ResolvedTime"); + if (resolvedTimeValue != null) + { + Calendar resolvedTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(resolvedTimeValue.getTextValue())); + resolvedTimeInstance = calendar2; + incidentInstance.setResolvedTime(resolvedTimeInstance); + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @param ruleId The rule id. + * @param isActive A boolean to retrieve only active or resolved incidents. + * @return The List incidents operation response. + */ + @Override + public Future listForRuleAsync(final String ruleId, final boolean isActive) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public IncidentListResponse call() throws Exception + { + return listForRule(ruleId, isActive); + } + }); + } + + /** + * + * @param ruleId The rule id. + * @param isActive A boolean to retrieve only active or resolved incidents. + * @return The List incidents operation response. + */ + @Override + public IncidentListResponse listForRule(String ruleId, boolean isActive) throws IOException, ServiceException, ParseException + { + // Validate + if (ruleId == null) + { + throw new NullPointerException("ruleId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertrules/" + ruleId + "/alertincidents?$filter=IsActive eq " + isActive; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + IncidentListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new IncidentListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + IncidentCollection incidentCollectionInstance = new IncidentCollection(); + result.setIncidentCollection(incidentCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + Incident incidentInstance = new Incident(); + incidentCollectionInstance.getValue().add(incidentInstance); + + JsonNode idValue = valueValue.get("Id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + incidentInstance.setId(idInstance); + } + + JsonNode ruleIdValue = valueValue.get("RuleId"); + if (ruleIdValue != null) + { + String ruleIdInstance; + ruleIdInstance = ruleIdValue.getTextValue(); + incidentInstance.setRuleId(ruleIdInstance); + } + + JsonNode isActiveValue = valueValue.get("IsActive"); + if (isActiveValue != null) + { + boolean isActiveInstance; + isActiveInstance = isActiveValue.getBooleanValue(); + incidentInstance.setIsActive(isActiveInstance); + } + + JsonNode activatedTimeValue = valueValue.get("ActivatedTime"); + if (activatedTimeValue != null) + { + Calendar activatedTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(activatedTimeValue.getTextValue())); + activatedTimeInstance = calendar; + incidentInstance.setActivatedTime(activatedTimeInstance); + } + + JsonNode resolvedTimeValue = valueValue.get("ResolvedTime"); + if (resolvedTimeValue != null) + { + Calendar resolvedTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(resolvedTimeValue.getTextValue())); + resolvedTimeInstance = calendar2; + incidentInstance.setResolvedTime(resolvedTimeInstance); + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperations.java new file mode 100644 index 000000000000..6eab3f87267e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperations.java @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleCreateOrUpdateParameters; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleGetResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.ParseException; +import java.util.concurrent.Future; + +/** +* Operations for managing the alert rules. +*/ +public interface RuleOperations +{ + /** + * + * @param parameters The rule to create or update. + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse createOrUpdate(RuleCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException; + + /** + * + * @param parameters The rule to create or update. + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future createOrUpdateAsync(RuleCreateOrUpdateParameters parameters); + + /** + * + * @param ruleId The id of the rule to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse delete(String ruleId) throws IOException, ServiceException; + + /** + * + * @param ruleId The id of the rule to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future deleteAsync(String ruleId); + + /** + * + * @param ruleId The id of the rule to retrieve. + * @return The Get Rule operation response. + */ + RuleGetResponse get(String ruleId) throws IOException, ServiceException, ParseException; + + /** + * + * @param ruleId The id of the rule to retrieve. + * @return The Get Rule operation response. + */ + Future getAsync(String ruleId); + + /** + * + * @return The List Rules operation response. + */ + RuleListResponse list() throws IOException, ServiceException, ParseException; + + /** + * + * @return The List Rules operation response. + */ + Future listAsync(); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperationsImpl.java new file mode 100644 index 000000000000..dc40bcac61f2 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/RuleOperationsImpl.java @@ -0,0 +1,776 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.Rule; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleAction; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleCollection; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleCreateOrUpdateParameters; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleEmailAction; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleGetResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleListResponse; +import com.microsoft.windowsazure.management.monitoring.alerts.models.RuleMetricDataSource; +import com.microsoft.windowsazure.management.monitoring.alerts.models.ThresholdRuleCondition; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.TimeSpan8601Converter; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.TimeZone; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.xml.datatype.Duration; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.StringEntity; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; + +/** +* Operations for managing the alert rules. +*/ +public class RuleOperationsImpl implements ServiceOperations, RuleOperations +{ + /** + * Initializes a new instance of the RuleOperationsImpl class. + * + * @param client Reference to the service client. + */ + RuleOperationsImpl(AlertsClientImpl client) + { + this.client = client; + } + + private AlertsClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.alerts.AlertsClientImpl. + */ + public AlertsClientImpl getClient() { return this.client; } + + /** + * + * @param parameters The rule to create or update. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future createOrUpdateAsync(final RuleCreateOrUpdateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return createOrUpdate(parameters); + } + }); + } + + /** + * + * @param parameters The rule to create or update. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse createOrUpdate(RuleCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException + { + // Validate + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertrules/" + parameters.getRule().getId(); + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + if (parameters.getRule() != null) + { + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode ruleValue = objectMapper.createObjectNode(); + requestDoc = ruleValue; + + if (parameters.getRule().getId() != null) + { + ruleValue.put("Id", parameters.getRule().getId()); + } + + if (parameters.getRule().getName() != null) + { + ruleValue.put("Name", parameters.getRule().getName()); + } + + if (parameters.getRule().getDescription() != null) + { + ruleValue.put("Description", parameters.getRule().getDescription()); + } + + ruleValue.put("IsEnabled", parameters.getRule().getIsEnabled()); + + if (parameters.getRule().getCondition() != null) + { + ObjectNode conditionValue = objectMapper.createObjectNode(); + ruleValue.put("Condition", conditionValue); + conditionValue.put("odata.type", parameters.getRule().getCondition().getClass().getName()); + if (parameters.getRule().getCondition().getClass().isInstance(ThresholdRuleCondition.class)) + { + ThresholdRuleCondition derived = ((ThresholdRuleCondition)parameters.getRule().getCondition()); + + if (derived.getDataSource() != null) + { + ObjectNode dataSourceValue = objectMapper.createObjectNode(); + conditionValue.put("DataSource", dataSourceValue); + dataSourceValue.put("odata.type", derived.getDataSource().getClass().getName()); + if (derived.getDataSource().getClass().isInstance(RuleMetricDataSource.class)) + { + RuleMetricDataSource derived2 = ((RuleMetricDataSource)derived.getDataSource()); + + if (derived2.getResourceId() != null) + { + dataSourceValue.put("ResourceId", derived2.getResourceId()); + } + + if (derived2.getMetricNamespace() != null) + { + dataSourceValue.put("MetricNamespace", derived2.getMetricNamespace()); + } + + if (derived2.getMetricName() != null) + { + dataSourceValue.put("MetricName", derived2.getMetricName()); + } + } + } + + if (derived.getOperator() != null) + { + conditionValue.put("Operator", derived.getOperator()); + } + + conditionValue.put("Threshold", derived.getThreshold()); + + conditionValue.put("WindowSize", TimeSpan8601Converter.format(derived.getWindowSize())); + } + } + + if (parameters.getRule().getActions() != null) + { + ArrayNode actionsArray = objectMapper.createArrayNode(); + for (RuleAction actionsItem : parameters.getRule().getActions()) + { + ObjectNode ruleActionValue = objectMapper.createObjectNode(); + actionsArray.add(ruleActionValue); + ruleActionValue.put("odata.type", actionsItem.getClass().getName()); + if (actionsItem.getClass().isInstance(RuleEmailAction.class)) + { + RuleEmailAction derived3 = ((RuleEmailAction)actionsItem); + + ruleActionValue.put("SendToServiceOwners", derived3.getSendToServiceOwners()); + + if (derived3.getCustomEmails() != null) + { + ArrayNode customEmailsArray = objectMapper.createArrayNode(); + for (String customEmailsItem : derived3.getCustomEmails()) + { + customEmailsArray.add(customEmailsItem); + } + ruleActionValue.put("CustomEmails", customEmailsArray); + } + } + } + ruleValue.put("Actions", actionsArray); + } + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + ruleValue.put("LastUpdatedTime", simpleDateFormat.format(parameters.getRule().getLastUpdatedTime().getTime())); + } + + ObjectMapper objectMapper2 = new ObjectMapper(); + StringWriter stringWriter = new StringWriter(); + objectMapper2.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200 && statusCode != 201) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @param ruleId The id of the rule to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future deleteAsync(final String ruleId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(ruleId); + } + }); + } + + /** + * + * @param ruleId The id of the rule to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse delete(String ruleId) throws IOException, ServiceException + { + // Validate + if (ruleId == null) + { + throw new NullPointerException("ruleId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertrules/" + ruleId; + + // Create HTTP transport objects + CustomHttpDelete httpRequest = new CustomHttpDelete(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @param ruleId The id of the rule to retrieve. + * @return The Get Rule operation response. + */ + @Override + public Future getAsync(final String ruleId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public RuleGetResponse call() throws Exception + { + return get(ruleId); + } + }); + } + + /** + * + * @param ruleId The id of the rule to retrieve. + * @return The Get Rule operation response. + */ + @Override + public RuleGetResponse get(String ruleId) throws IOException, ServiceException, ParseException + { + // Validate + if (ruleId == null) + { + throw new NullPointerException("ruleId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertrules/" + ruleId; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + RuleGetResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new RuleGetResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Rule ruleInstance = new Rule(); + result.setRule(ruleInstance); + + JsonNode idValue = responseDoc.get("Id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + ruleInstance.setId(idInstance); + } + + JsonNode nameValue = responseDoc.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + ruleInstance.setName(nameInstance); + } + + JsonNode descriptionValue = responseDoc.get("Description"); + if (descriptionValue != null) + { + String descriptionInstance; + descriptionInstance = descriptionValue.getTextValue(); + ruleInstance.setDescription(descriptionInstance); + } + + JsonNode isEnabledValue = responseDoc.get("IsEnabled"); + if (isEnabledValue != null) + { + boolean isEnabledInstance; + isEnabledInstance = isEnabledValue.getBooleanValue(); + ruleInstance.setIsEnabled(isEnabledInstance); + } + + JsonNode conditionValue = responseDoc.get("Condition"); + if (conditionValue != null) + { + String typeName = conditionValue.get("odata.type").getTextValue(); + if (typeName == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition") + { + ThresholdRuleCondition thresholdRuleConditionInstance = new ThresholdRuleCondition(); + + JsonNode dataSourceValue = conditionValue.get("DataSource"); + if (dataSourceValue != null) + { + String typeName2 = dataSourceValue.get("odata.type").getTextValue(); + if (typeName2 == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource") + { + RuleMetricDataSource ruleMetricDataSourceInstance = new RuleMetricDataSource(); + + JsonNode resourceIdValue = dataSourceValue.get("ResourceId"); + if (resourceIdValue != null) + { + String resourceIdInstance; + resourceIdInstance = resourceIdValue.getTextValue(); + ruleMetricDataSourceInstance.setResourceId(resourceIdInstance); + } + + JsonNode metricNamespaceValue = dataSourceValue.get("MetricNamespace"); + if (metricNamespaceValue != null) + { + String metricNamespaceInstance; + metricNamespaceInstance = metricNamespaceValue.getTextValue(); + ruleMetricDataSourceInstance.setMetricNamespace(metricNamespaceInstance); + } + + JsonNode metricNameValue = dataSourceValue.get("MetricName"); + if (metricNameValue != null) + { + String metricNameInstance; + metricNameInstance = metricNameValue.getTextValue(); + ruleMetricDataSourceInstance.setMetricName(metricNameInstance); + } + thresholdRuleConditionInstance.setDataSource(ruleMetricDataSourceInstance); + } + } + + JsonNode operatorValue = conditionValue.get("Operator"); + if (operatorValue != null) + { + String operatorInstance; + operatorInstance = operatorValue.getTextValue(); + thresholdRuleConditionInstance.setOperator(operatorInstance); + } + + JsonNode thresholdValue = conditionValue.get("Threshold"); + if (thresholdValue != null) + { + double thresholdInstance; + thresholdInstance = thresholdValue.getDoubleValue(); + thresholdRuleConditionInstance.setThreshold(thresholdInstance); + } + + JsonNode windowSizeValue = conditionValue.get("WindowSize"); + if (windowSizeValue != null) + { + Duration windowSizeInstance; + windowSizeInstance = TimeSpan8601Converter.parse(windowSizeValue.getTextValue()); + thresholdRuleConditionInstance.setWindowSize(windowSizeInstance); + } + ruleInstance.setCondition(thresholdRuleConditionInstance); + } + } + + ArrayNode actionsArray = ((ArrayNode)responseDoc.get("Actions")); + if (actionsArray != null) + { + for (JsonNode actionsValue : actionsArray) + { + String typeName3 = actionsValue.get("odata.type").getTextValue(); + if (typeName3 == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction") + { + RuleEmailAction ruleEmailActionInstance = new RuleEmailAction(); + + JsonNode sendToServiceOwnersValue = actionsValue.get("SendToServiceOwners"); + if (sendToServiceOwnersValue != null) + { + boolean sendToServiceOwnersInstance; + sendToServiceOwnersInstance = sendToServiceOwnersValue.getBooleanValue(); + ruleEmailActionInstance.setSendToServiceOwners(sendToServiceOwnersInstance); + } + + ArrayNode customEmailsArray = ((ArrayNode)actionsValue.get("CustomEmails")); + if (customEmailsArray != null) + { + for (JsonNode customEmailsValue : customEmailsArray) + { + ruleEmailActionInstance.getCustomEmails().add(customEmailsValue.getTextValue()); + } + } + ruleInstance.getActions().add(ruleEmailActionInstance); + } + } + } + + JsonNode lastUpdatedTimeValue = responseDoc.get("LastUpdatedTime"); + if (lastUpdatedTimeValue != null) + { + Calendar lastUpdatedTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(lastUpdatedTimeValue.getTextValue())); + lastUpdatedTimeInstance = calendar; + ruleInstance.setLastUpdatedTime(lastUpdatedTimeInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @return The List Rules operation response. + */ + @Override + public Future listAsync() + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public RuleListResponse call() throws Exception + { + return list(); + } + }); + } + + /** + * + * @return The List Rules operation response. + */ + @Override + public RuleListResponse list() throws IOException, ServiceException, ParseException + { + // Validate + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/alertrules"; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + RuleListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new RuleListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + RuleCollection ruleCollectionInstance = new RuleCollection(); + result.setRuleCollection(ruleCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + Rule ruleInstance = new Rule(); + ruleCollectionInstance.getValue().add(ruleInstance); + + JsonNode idValue = valueValue.get("Id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + ruleInstance.setId(idInstance); + } + + JsonNode nameValue = valueValue.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + ruleInstance.setName(nameInstance); + } + + JsonNode descriptionValue = valueValue.get("Description"); + if (descriptionValue != null) + { + String descriptionInstance; + descriptionInstance = descriptionValue.getTextValue(); + ruleInstance.setDescription(descriptionInstance); + } + + JsonNode isEnabledValue = valueValue.get("IsEnabled"); + if (isEnabledValue != null) + { + boolean isEnabledInstance; + isEnabledInstance = isEnabledValue.getBooleanValue(); + ruleInstance.setIsEnabled(isEnabledInstance); + } + + JsonNode conditionValue = valueValue.get("Condition"); + if (conditionValue != null) + { + String typeName = conditionValue.get("odata.type").getTextValue(); + if (typeName == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition") + { + ThresholdRuleCondition thresholdRuleConditionInstance = new ThresholdRuleCondition(); + + JsonNode dataSourceValue = conditionValue.get("DataSource"); + if (dataSourceValue != null) + { + String typeName2 = dataSourceValue.get("odata.type").getTextValue(); + if (typeName2 == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource") + { + RuleMetricDataSource ruleMetricDataSourceInstance = new RuleMetricDataSource(); + + JsonNode resourceIdValue = dataSourceValue.get("ResourceId"); + if (resourceIdValue != null) + { + String resourceIdInstance; + resourceIdInstance = resourceIdValue.getTextValue(); + ruleMetricDataSourceInstance.setResourceId(resourceIdInstance); + } + + JsonNode metricNamespaceValue = dataSourceValue.get("MetricNamespace"); + if (metricNamespaceValue != null) + { + String metricNamespaceInstance; + metricNamespaceInstance = metricNamespaceValue.getTextValue(); + ruleMetricDataSourceInstance.setMetricNamespace(metricNamespaceInstance); + } + + JsonNode metricNameValue = dataSourceValue.get("MetricName"); + if (metricNameValue != null) + { + String metricNameInstance; + metricNameInstance = metricNameValue.getTextValue(); + ruleMetricDataSourceInstance.setMetricName(metricNameInstance); + } + thresholdRuleConditionInstance.setDataSource(ruleMetricDataSourceInstance); + } + } + + JsonNode operatorValue = conditionValue.get("Operator"); + if (operatorValue != null) + { + String operatorInstance; + operatorInstance = operatorValue.getTextValue(); + thresholdRuleConditionInstance.setOperator(operatorInstance); + } + + JsonNode thresholdValue = conditionValue.get("Threshold"); + if (thresholdValue != null) + { + double thresholdInstance; + thresholdInstance = thresholdValue.getDoubleValue(); + thresholdRuleConditionInstance.setThreshold(thresholdInstance); + } + + JsonNode windowSizeValue = conditionValue.get("WindowSize"); + if (windowSizeValue != null) + { + Duration windowSizeInstance; + windowSizeInstance = TimeSpan8601Converter.parse(windowSizeValue.getTextValue()); + thresholdRuleConditionInstance.setWindowSize(windowSizeInstance); + } + ruleInstance.setCondition(thresholdRuleConditionInstance); + } + } + + ArrayNode actionsArray = ((ArrayNode)valueValue.get("Actions")); + if (actionsArray != null) + { + for (JsonNode actionsValue : actionsArray) + { + String typeName3 = actionsValue.get("odata.type").getTextValue(); + if (typeName3 == "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction") + { + RuleEmailAction ruleEmailActionInstance = new RuleEmailAction(); + + JsonNode sendToServiceOwnersValue = actionsValue.get("SendToServiceOwners"); + if (sendToServiceOwnersValue != null) + { + boolean sendToServiceOwnersInstance; + sendToServiceOwnersInstance = sendToServiceOwnersValue.getBooleanValue(); + ruleEmailActionInstance.setSendToServiceOwners(sendToServiceOwnersInstance); + } + + ArrayNode customEmailsArray = ((ArrayNode)actionsValue.get("CustomEmails")); + if (customEmailsArray != null) + { + for (JsonNode customEmailsValue : customEmailsArray) + { + ruleEmailActionInstance.getCustomEmails().add(customEmailsValue.getTextValue()); + } + } + ruleInstance.getActions().add(ruleEmailActionInstance); + } + } + } + + JsonNode lastUpdatedTimeValue = valueValue.get("LastUpdatedTime"); + if (lastUpdatedTimeValue != null) + { + Calendar lastUpdatedTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(lastUpdatedTimeValue.getTextValue())); + lastUpdatedTimeInstance = calendar; + ruleInstance.setLastUpdatedTime(lastUpdatedTimeInstance); + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Incident.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Incident.java new file mode 100644 index 000000000000..8bcfa1a45726 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Incident.java @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import java.util.Calendar; + +/** +* An alert incident. +*/ +public class Incident +{ + private Calendar activatedTime; + + /** + * The time at which the incident got activated. + */ + public Calendar getActivatedTime() { return this.activatedTime; } + + /** + * The time at which the incident got activated. + */ + public void setActivatedTime(Calendar activatedTime) { this.activatedTime = activatedTime; } + + private String id; + + /** + * Incident identifier. + */ + public String getId() { return this.id; } + + /** + * Incident identifier. + */ + public void setId(String id) { this.id = id; } + + private boolean isActive; + + /** + * A boolean to indicate whether the incident is active or resolved. + */ + public boolean getIsActive() { return this.isActive; } + + /** + * A boolean to indicate whether the incident is active or resolved. + */ + public void setIsActive(boolean isActive) { this.isActive = isActive; } + + private Calendar resolvedTime; + + /** + * The time at which the incident got resolved. If null, it means the + * incident is still active. + */ + public Calendar getResolvedTime() { return this.resolvedTime; } + + /** + * The time at which the incident got resolved. If null, it means the + * incident is still active. + */ + public void setResolvedTime(Calendar resolvedTime) { this.resolvedTime = resolvedTime; } + + private String ruleId; + + /** + * Rule identifier. + */ + public String getRuleId() { return this.ruleId; } + + /** + * Rule identifier. + */ + public void setRuleId(String ruleId) { this.ruleId = ruleId; } + + /** + * Initializes a new instance of the Incident class. + * + */ + public Incident() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentCollection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentCollection.java new file mode 100644 index 000000000000..0b92feb21e3f --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentCollection.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import java.util.ArrayList; + +/** +* Alert incidents collection. +*/ +public class IncidentCollection +{ + private ArrayList value; + + /** + * Incident collection. + */ + public ArrayList getValue() { return this.value; } + + /** + * Incident collection. + */ + public void setValue(ArrayList value) { this.value = value; } + + /** + * Initializes a new instance of the IncidentCollection class. + * + */ + public IncidentCollection() + { + this.value = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentGetResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentGetResponse.java new file mode 100644 index 000000000000..42b7467596b5 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentGetResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Get Incident operation response. +*/ +public class IncidentGetResponse extends OperationResponse +{ + private Incident incident; + + /** + * The retrieved incident. + */ + public Incident getIncident() { return this.incident; } + + /** + * The retrieved incident. + */ + public void setIncident(Incident incident) { this.incident = incident; } + + /** + * Initializes a new instance of the IncidentGetResponse class. + * + */ + public IncidentGetResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentListResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentListResponse.java new file mode 100644 index 000000000000..b36c2ab18fb6 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/IncidentListResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The List incidents operation response. +*/ +public class IncidentListResponse extends OperationResponse +{ + private IncidentCollection incidentCollection; + + /** + * The retrieved incidents. + */ + public IncidentCollection getIncidentCollection() { return this.incidentCollection; } + + /** + * The retrieved incidents. + */ + public void setIncidentCollection(IncidentCollection incidentCollection) { this.incidentCollection = incidentCollection; } + + /** + * Initializes a new instance of the IncidentListResponse class. + * + */ + public IncidentListResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Rule.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Rule.java new file mode 100644 index 000000000000..d71e7e1595d6 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/Rule.java @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import java.util.ArrayList; +import java.util.Calendar; + +/** +* An alert rule. +*/ +public class Rule +{ + private ArrayList actions; + + /** + * Rule actions. + */ + public ArrayList getActions() { return this.actions; } + + /** + * Rule actions. + */ + public void setActions(ArrayList actions) { this.actions = actions; } + + private RuleCondition condition; + + /** + * Rule condition. + */ + public RuleCondition getCondition() { return this.condition; } + + /** + * Rule condition. + */ + public void setCondition(RuleCondition condition) { this.condition = condition; } + + private String description; + + /** + * Rule description. + */ + public String getDescription() { return this.description; } + + /** + * Rule description. + */ + public void setDescription(String description) { this.description = description; } + + private String id; + + /** + * Rule identifier. + */ + public String getId() { return this.id; } + + /** + * Rule identifier. + */ + public void setId(String id) { this.id = id; } + + private boolean isEnabled; + + /** + * A flag that determines whether the rule is enabled or disabled. + */ + public boolean getIsEnabled() { return this.isEnabled; } + + /** + * A flag that determines whether the rule is enabled or disabled. + */ + public void setIsEnabled(boolean isEnabled) { this.isEnabled = isEnabled; } + + private Calendar lastUpdatedTime; + + /** + * Rule last updated time. + */ + public Calendar getLastUpdatedTime() { return this.lastUpdatedTime; } + + /** + * Rule last updated time. + */ + public void setLastUpdatedTime(Calendar lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } + + private String name; + + /** + * Rule name. + */ + public String getName() { return this.name; } + + /** + * Rule name. + */ + public void setName(String name) { this.name = name; } + + /** + * Initializes a new instance of the Rule class. + * + */ + public Rule() + { + this.actions = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleAction.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleAction.java new file mode 100644 index 000000000000..22a30cb60516 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleAction.java @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +/** +* A rule action. +*/ +public abstract class RuleAction +{ + /** + * Initializes a new instance of the RuleAction class. + * + */ + public RuleAction() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCollection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCollection.java new file mode 100644 index 000000000000..975ddce8c189 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCollection.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import java.util.ArrayList; + +/** +* Alert rules collection. +*/ +public class RuleCollection +{ + private ArrayList value; + + /** + * Rule collection. + */ + public ArrayList getValue() { return this.value; } + + /** + * Rule collection. + */ + public void setValue(ArrayList value) { this.value = value; } + + /** + * Initializes a new instance of the RuleCollection class. + * + */ + public RuleCollection() + { + this.value = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCondition.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCondition.java new file mode 100644 index 000000000000..096a9b454281 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCondition.java @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +/** +* A rule condition. +*/ +public abstract class RuleCondition +{ + /** + * Initializes a new instance of the RuleCondition class. + * + */ + public RuleCondition() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCreateOrUpdateParameters.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCreateOrUpdateParameters.java new file mode 100644 index 000000000000..149ab8505674 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleCreateOrUpdateParameters.java @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +/** +* Parameters supplied to the Create or Update Rule operation. +*/ +public class RuleCreateOrUpdateParameters +{ + private Rule rule; + + /** + * The rule to create or update. + */ + public Rule getRule() { return this.rule; } + + /** + * The rule to create or update. + */ + public void setRule(Rule rule) { this.rule = rule; } + + /** + * Initializes a new instance of the RuleCreateOrUpdateParameters class. + * + */ + public RuleCreateOrUpdateParameters() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleDataSource.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleDataSource.java new file mode 100644 index 000000000000..f3228695ab32 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleDataSource.java @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +/** +* A rule data source. +*/ +public abstract class RuleDataSource +{ + /** + * Initializes a new instance of the RuleDataSource class. + * + */ + public RuleDataSource() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleEmailAction.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleEmailAction.java new file mode 100644 index 000000000000..7f77e94cddf8 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleEmailAction.java @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import java.util.ArrayList; + +/** +* A rule email action. +*/ +public class RuleEmailAction extends RuleAction +{ + private ArrayList customEmails; + + /** + * Custom emails. + */ + public ArrayList getCustomEmails() { return this.customEmails; } + + /** + * Custom emails. + */ + public void setCustomEmails(ArrayList customEmails) { this.customEmails = customEmails; } + + private boolean sendToServiceOwners; + + /** + * Whether to send email to service owners or not. + */ + public boolean getSendToServiceOwners() { return this.sendToServiceOwners; } + + /** + * Whether to send email to service owners or not. + */ + public void setSendToServiceOwners(boolean sendToServiceOwners) { this.sendToServiceOwners = sendToServiceOwners; } + + /** + * Initializes a new instance of the RuleEmailAction class. + * + */ + public RuleEmailAction() + { + this.customEmails = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleGetResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleGetResponse.java new file mode 100644 index 000000000000..cc26bef2455e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleGetResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Get Rule operation response. +*/ +public class RuleGetResponse extends OperationResponse +{ + private Rule rule; + + /** + * The retrieved rule. + */ + public Rule getRule() { return this.rule; } + + /** + * The retrieved rule. + */ + public void setRule(Rule rule) { this.rule = rule; } + + /** + * Initializes a new instance of the RuleGetResponse class. + * + */ + public RuleGetResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleListResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleListResponse.java new file mode 100644 index 000000000000..43fcdcdf5d45 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleListResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The List Rules operation response. +*/ +public class RuleListResponse extends OperationResponse +{ + private RuleCollection ruleCollection; + + /** + * The retrieved rules. + */ + public RuleCollection getRuleCollection() { return this.ruleCollection; } + + /** + * The retrieved rules. + */ + public void setRuleCollection(RuleCollection ruleCollection) { this.ruleCollection = ruleCollection; } + + /** + * Initializes a new instance of the RuleListResponse class. + * + */ + public RuleListResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleMetricDataSource.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleMetricDataSource.java new file mode 100644 index 000000000000..d3889c09c820 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/RuleMetricDataSource.java @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +/** +* A rule metric data source. +*/ +public class RuleMetricDataSource extends RuleDataSource +{ + private String metricName; + + /** + * Metric name. + */ + public String getMetricName() { return this.metricName; } + + /** + * Metric name. + */ + public void setMetricName(String metricName) { this.metricName = metricName; } + + private String metricNamespace; + + /** + * Metric namespace. + */ + public String getMetricNamespace() { return this.metricNamespace; } + + /** + * Metric namespace. + */ + public void setMetricNamespace(String metricNamespace) { this.metricNamespace = metricNamespace; } + + private String resourceId; + + /** + * Metric resource id. + */ + public String getResourceId() { return this.resourceId; } + + /** + * Metric resource id. + */ + public void setResourceId(String resourceId) { this.resourceId = resourceId; } + + /** + * Initializes a new instance of the RuleMetricDataSource class. + * + */ + public RuleMetricDataSource() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/ThresholdRuleCondition.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/ThresholdRuleCondition.java new file mode 100644 index 000000000000..5677e6ea5b77 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/models/ThresholdRuleCondition.java @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.alerts.models; + +import javax.xml.datatype.Duration; + +/** +* A threshold rule condition. +*/ +public class ThresholdRuleCondition extends RuleCondition +{ + private RuleDataSource dataSource; + + /** + * Condition data source. + */ + public RuleDataSource getDataSource() { return this.dataSource; } + + /** + * Condition data source. + */ + public void setDataSource(RuleDataSource dataSource) { this.dataSource = dataSource; } + + private String operator; + + /** + * Condition operator. + */ + public String getOperator() { return this.operator; } + + /** + * Condition operator. + */ + public void setOperator(String operator) { this.operator = operator; } + + private double threshold; + + /** + * Condition threshold. + */ + public double getThreshold() { return this.threshold; } + + /** + * Condition threshold. + */ + public void setThreshold(double threshold) { this.threshold = threshold; } + + private Duration windowSize; + + /** + * Condition window size. + */ + public Duration getWindowSize() { return this.windowSize; } + + /** + * Condition window size. + */ + public void setWindowSize(Duration windowSize) { this.windowSize = windowSize; } + + /** + * Initializes a new instance of the ThresholdRuleCondition class. + * + */ + public ThresholdRuleCondition() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/package.html b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/package.html new file mode 100644 index 000000000000..e8dfd96862b7 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/alerts/package.html @@ -0,0 +1,6 @@ + + +This package contains the service management class, + interface, and associated configuration and utility classes. + + diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClient.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClient.java new file mode 100644 index 000000000000..5ba3316ccae8 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClient.java @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import java.net.URI; + +public interface AutoscaleClient +{ + /** + * Optional base uri parameter. + */ + URI getBaseUri(); + + /** + * When you create a Windows Azure subscription, it is uniquely identified + * by a subscription ID. The subscription ID forms part of the URI for + * every call that you make to the Service Management API. The Windows + * Azure Service ManagementAPI use mutual authentication of management + * certificates over SSL to ensure that a request made to the service is + * secure. No anonymous requests are allowed. + */ + SubscriptionCloudCredentials getCredentials(); + + /** + * Operations for managing the autoscale settings. + */ + SettingOperations getSettings(); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClientImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClientImpl.java new file mode 100644 index 000000000000..100c1e35726c --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleClientImpl.java @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.management.ManagementConfiguration; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.services.core.ServiceClient; +import java.net.URI; +import javax.inject.Inject; +import javax.inject.Named; + +public class AutoscaleClientImpl extends ServiceClient implements AutoscaleClient +{ + private URI baseUri; + + /** + * Optional base uri parameter. + */ + public URI getBaseUri() { return this.baseUri; } + + private SubscriptionCloudCredentials credentials; + + /** + * When you create a Windows Azure subscription, it is uniquely identified + * by a subscription ID. The subscription ID forms part of the URI for + * every call that you make to the Service Management API. The Windows + * Azure Service ManagementAPI use mutual authentication of management + * certificates over SSL to ensure that a request made to the service is + * secure. No anonymous requests are allowed. + */ + public SubscriptionCloudCredentials getCredentials() { return this.credentials; } + + private SettingOperations settings; + + /** + * Operations for managing the autoscale settings. + */ + public SettingOperations getSettings() { return this.settings; } + + /** + * Initializes a new instance of the AutoscaleClientImpl class. + * + */ + private AutoscaleClientImpl() + { + super(); + this.settings = new SettingOperationsImpl(this); + } + + /** + * Initializes a new instance of the AutoscaleClientImpl class. + * + * @param credentials When you create a Windows Azure subscription, it is + * uniquely identified by a subscription ID. The subscription ID forms part + * of the URI for every call that you make to the Service Management API. + * The Windows Azure Service ManagementAPI use mutual authentication of + * management certificates over SSL to ensure that a request made to the + * service is secure. No anonymous requests are allowed. + * @param baseUri Optional base uri parameter. + */ + public AutoscaleClientImpl(SubscriptionCloudCredentials credentials, URI baseUri) + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (baseUri == null) + { + throw new NullPointerException("baseUri"); + } + this.credentials = credentials; + this.baseUri = baseUri; + + httpClient = credentials.initializeClient(); + } + + /** + * Initializes a new instance of the AutoscaleClientImpl class. + * + * @param credentials When you create a Windows Azure subscription, it is + * uniquely identified by a subscription ID. The subscription ID forms part + * of the URI for every call that you make to the Service Management API. + * The Windows Azure Service ManagementAPI use mutual authentication of + * management certificates over SSL to ensure that a request made to the + * service is secure. No anonymous requests are allowed. + */ + @Inject + public AutoscaleClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CREDENTIALS) SubscriptionCloudCredentials credentials) throws java.net.URISyntaxException + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + this.credentials = credentials; + this.baseUri = new URI("https://management.core.windows.net"); + + httpClient = credentials.initializeClient(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleService.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleService.java new file mode 100644 index 000000000000..fe5d8e86d921 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/AutoscaleService.java @@ -0,0 +1,70 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access service management functionality. + * + */ +public class AutoscaleService { + + private AutoscaleService() { + // class is not instantiated + } + + /** + * Creates an instance of the AutoscaleClient API. + * + */ + public static AutoscaleClient create() { + return Configuration.getInstance().create(AutoscaleClient.class); + } + + /** + * Creates an instance of the AutoscaleClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static AutoscaleClient create(Configuration config) { + return config.create(AutoscaleClient.class); + } + + /** + * Creates an instance of the AutoscaleClient API. + * + * @param profile + * A String object that representing the profile of the service management service. + * + */ + public static AutoscaleClient create(String profile) { + return Configuration.getInstance().create(profile, AutoscaleClient.class); + } + + /** + * Creates an instance of the AutoscaleClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static AutoscaleClient create(String profile, Configuration config) { + return config.create(profile, AutoscaleClient.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/Exports.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/Exports.java new file mode 100644 index 000000000000..a2dbaa1efe78 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/Exports.java @@ -0,0 +1,34 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.services.core.Builder; + +/** + * The Class Exports. + */ +public class Exports implements Builder.Exports { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.Builder.Exports#register(com.microsoft.windowsazure.services.core.Builder.Registry) + */ + @Override + public void register(Builder.Registry registry) { + + // provide contract implementation + registry.add(AutoscaleClient.class, AutoscaleClientImpl.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperations.java new file mode 100644 index 000000000000..cfed7677bc75 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperations.java @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleSettingCreateOrUpdateParameters; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleSettingGetResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.ParseException; +import java.util.concurrent.Future; + +/** +* Operations for managing the autoscale settings. +*/ +public interface SettingOperations +{ + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse createOrUpdate(String resourceId, AutoscaleSettingCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException; + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future createOrUpdateAsync(String resourceId, AutoscaleSettingCreateOrUpdateParameters parameters); + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse delete(String resourceId) throws IOException, ServiceException; + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future deleteAsync(String resourceId); + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + AutoscaleSettingGetResponse get(String resourceId) throws IOException, ServiceException, ParseException; + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future getAsync(String resourceId); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperationsImpl.java new file mode 100644 index 000000000000..dba897359518 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/SettingOperationsImpl.java @@ -0,0 +1,800 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleProfile; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleSetting; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleSettingCreateOrUpdateParameters; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.AutoscaleSettingGetResponse; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ComparisonOperationType; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.MetricStatisticType; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.MetricTrigger; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.Recurrence; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.RecurrenceFrequency; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.RecurrentSchedule; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ScaleAction; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ScaleCapacity; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ScaleDirection; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ScaleRule; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.ScaleType; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.TimeAggregationType; +import com.microsoft.windowsazure.management.monitoring.autoscale.models.TimeWindow; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.TimeZone; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.StringEntity; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; + +/** +* Operations for managing the autoscale settings. +*/ +public class SettingOperationsImpl implements ServiceOperations, SettingOperations +{ + /** + * Initializes a new instance of the SettingOperationsImpl class. + * + * @param client Reference to the service client. + */ + SettingOperationsImpl(AutoscaleClientImpl client) + { + this.client = client; + } + + private AutoscaleClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.autoscale.AutoscaleClientImpl. + */ + public AutoscaleClientImpl getClient() { return this.client; } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future createOrUpdateAsync(final String resourceId, final AutoscaleSettingCreateOrUpdateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return createOrUpdate(resourceId, parameters); + } + }); + } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse createOrUpdate(String resourceId, AutoscaleSettingCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/autoscalesettings?resourceId=" + resourceId; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + if (parameters.getSetting() != null) + { + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode settingValue = objectMapper.createObjectNode(); + requestDoc = settingValue; + + if (parameters.getSetting().getProfiles() != null) + { + ArrayNode profilesArray = objectMapper.createArrayNode(); + for (AutoscaleProfile profilesItem : parameters.getSetting().getProfiles()) + { + ObjectNode autoscaleProfileValue = objectMapper.createObjectNode(); + profilesArray.add(autoscaleProfileValue); + + if (profilesItem.getName() != null) + { + autoscaleProfileValue.put("Name", profilesItem.getName()); + } + + if (profilesItem.getCapacity() != null) + { + ObjectNode capacityValue = objectMapper.createObjectNode(); + autoscaleProfileValue.put("Capacity", capacityValue); + + if (profilesItem.getCapacity().getMinimum() != null) + { + capacityValue.put("Minimum", profilesItem.getCapacity().getMinimum()); + } + + if (profilesItem.getCapacity().getMaximum() != null) + { + capacityValue.put("Maximum", profilesItem.getCapacity().getMaximum()); + } + + if (profilesItem.getCapacity().getDefault() != null) + { + capacityValue.put("Default", profilesItem.getCapacity().getDefault()); + } + } + + if (profilesItem.getRules() != null) + { + ArrayNode rulesArray = objectMapper.createArrayNode(); + for (ScaleRule rulesItem : profilesItem.getRules()) + { + ObjectNode scaleRuleValue = objectMapper.createObjectNode(); + rulesArray.add(scaleRuleValue); + + if (rulesItem.getMetricTrigger() != null) + { + ObjectNode metricTriggerValue = objectMapper.createObjectNode(); + scaleRuleValue.put("MetricTrigger", metricTriggerValue); + + if (rulesItem.getMetricTrigger().getName() != null) + { + metricTriggerValue.put("Name", rulesItem.getMetricTrigger().getName()); + } + + if (rulesItem.getMetricTrigger().getNamespace() != null) + { + metricTriggerValue.put("Namespace", rulesItem.getMetricTrigger().getNamespace()); + } + + if (rulesItem.getMetricTrigger().getResource() != null) + { + metricTriggerValue.put("Resource", rulesItem.getMetricTrigger().getResource()); + } + + if (rulesItem.getMetricTrigger().getTimeGrain() != null) + { + metricTriggerValue.put("TimeGrain", rulesItem.getMetricTrigger().getTimeGrain()); + } + + metricTriggerValue.put("Statistic", rulesItem.getMetricTrigger().getStatistic().toString()); + + if (rulesItem.getMetricTrigger().getTimeWindow() != null) + { + metricTriggerValue.put("TimeWindow", rulesItem.getMetricTrigger().getTimeWindow()); + } + + metricTriggerValue.put("TimeAggregation", rulesItem.getMetricTrigger().getTimeAggregation().toString()); + + metricTriggerValue.put("Operator", rulesItem.getMetricTrigger().getOperator().toString()); + + metricTriggerValue.put("Threshold", rulesItem.getMetricTrigger().getThreshold()); + } + + if (rulesItem.getScaleAction() != null) + { + ObjectNode scaleActionValue = objectMapper.createObjectNode(); + scaleRuleValue.put("ScaleAction", scaleActionValue); + + scaleActionValue.put("Direction", rulesItem.getScaleAction().getDirection().toString()); + + scaleActionValue.put("Type", rulesItem.getScaleAction().getType().toString()); + + if (rulesItem.getScaleAction().getValue() != null) + { + scaleActionValue.put("Value", rulesItem.getScaleAction().getValue()); + } + + if (rulesItem.getScaleAction().getCooldown() != null) + { + scaleActionValue.put("Cooldown", rulesItem.getScaleAction().getCooldown()); + } + } + } + autoscaleProfileValue.put("Rules", rulesArray); + } + + if (profilesItem.getFixedDate() != null) + { + ObjectNode fixedDateValue = objectMapper.createObjectNode(); + autoscaleProfileValue.put("FixedDate", fixedDateValue); + + if (profilesItem.getFixedDate().getTimeZone() != null) + { + fixedDateValue.put("TimeZone", profilesItem.getFixedDate().getTimeZone()); + } + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + fixedDateValue.put("Start", simpleDateFormat.format(profilesItem.getFixedDate().getStart().getTime())); + + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + fixedDateValue.put("End", simpleDateFormat2.format(profilesItem.getFixedDate().getEnd().getTime())); + } + + if (profilesItem.getRecurrence() != null) + { + ObjectNode recurrenceValue = objectMapper.createObjectNode(); + autoscaleProfileValue.put("Recurrence", recurrenceValue); + + recurrenceValue.put("Frequency", profilesItem.getRecurrence().getFrequency().toString()); + + if (profilesItem.getRecurrence().getSchedule() != null) + { + ObjectNode scheduleValue = objectMapper.createObjectNode(); + recurrenceValue.put("Schedule", scheduleValue); + + if (profilesItem.getRecurrence().getSchedule().getTimeZone() != null) + { + scheduleValue.put("TimeZone", profilesItem.getRecurrence().getSchedule().getTimeZone()); + } + + if (profilesItem.getRecurrence().getSchedule().getDays() != null) + { + ArrayNode daysArray = objectMapper.createArrayNode(); + for (String daysItem : profilesItem.getRecurrence().getSchedule().getDays()) + { + daysArray.add(daysItem); + } + scheduleValue.put("Days", daysArray); + } + + if (profilesItem.getRecurrence().getSchedule().getHours() != null) + { + ArrayNode hoursArray = objectMapper.createArrayNode(); + for (int hoursItem : profilesItem.getRecurrence().getSchedule().getHours()) + { + hoursArray.add(hoursItem); + } + scheduleValue.put("Hours", hoursArray); + } + + if (profilesItem.getRecurrence().getSchedule().getMinutes() != null) + { + ArrayNode minutesArray = objectMapper.createArrayNode(); + for (int minutesItem : profilesItem.getRecurrence().getSchedule().getMinutes()) + { + minutesArray.add(minutesItem); + } + scheduleValue.put("Minutes", minutesArray); + } + } + } + } + settingValue.put("Profiles", profilesArray); + } + + if (parameters.getSetting().getSubscriptionId() != null) + { + settingValue.put("SubscriptionId", parameters.getSetting().getSubscriptionId()); + } + + if (parameters.getSetting().getSource() != null) + { + settingValue.put("Source", parameters.getSetting().getSource()); + } + + settingValue.put("Enabled", parameters.getSetting().getEnabled()); + } + + ObjectMapper objectMapper2 = new ObjectMapper(); + StringWriter stringWriter = new StringWriter(); + objectMapper2.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200 && statusCode != 201) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future deleteAsync(final String resourceId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(resourceId); + } + }); + } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse delete(String resourceId) throws IOException, ServiceException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/autoscalesettings?resourceId=" + resourceId; + + // Create HTTP transport objects + CustomHttpDelete httpRequest = new CustomHttpDelete(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future getAsync(final String resourceId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public AutoscaleSettingGetResponse call() throws Exception + { + return get(resourceId); + } + }); + } + + /** + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public AutoscaleSettingGetResponse get(String resourceId) throws IOException, ServiceException, ParseException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/autoscalesettings?resourceId=" + resourceId; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + AutoscaleSettingGetResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new AutoscaleSettingGetResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + AutoscaleSetting settingInstance = new AutoscaleSetting(); + result.setSetting(settingInstance); + + ArrayNode profilesArray = ((ArrayNode)responseDoc.get("Profiles")); + if (profilesArray != null) + { + for (JsonNode profilesValue : profilesArray) + { + AutoscaleProfile autoscaleProfileInstance = new AutoscaleProfile(); + settingInstance.getProfiles().add(autoscaleProfileInstance); + + JsonNode nameValue = profilesValue.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + autoscaleProfileInstance.setName(nameInstance); + } + + JsonNode capacityValue = profilesValue.get("Capacity"); + if (capacityValue != null) + { + ScaleCapacity capacityInstance = new ScaleCapacity(); + autoscaleProfileInstance.setCapacity(capacityInstance); + + JsonNode minimumValue = capacityValue.get("Minimum"); + if (minimumValue != null) + { + String minimumInstance; + minimumInstance = minimumValue.getTextValue(); + capacityInstance.setMinimum(minimumInstance); + } + + JsonNode maximumValue = capacityValue.get("Maximum"); + if (maximumValue != null) + { + String maximumInstance; + maximumInstance = maximumValue.getTextValue(); + capacityInstance.setMaximum(maximumInstance); + } + + JsonNode defaultValue = capacityValue.get("Default"); + if (defaultValue != null) + { + String defaultInstance; + defaultInstance = defaultValue.getTextValue(); + capacityInstance.setDefault(defaultInstance); + } + } + + ArrayNode rulesArray = ((ArrayNode)profilesValue.get("Rules")); + if (rulesArray != null) + { + for (JsonNode rulesValue : rulesArray) + { + ScaleRule scaleRuleInstance = new ScaleRule(); + autoscaleProfileInstance.getRules().add(scaleRuleInstance); + + JsonNode metricTriggerValue = rulesValue.get("MetricTrigger"); + if (metricTriggerValue != null) + { + MetricTrigger metricTriggerInstance = new MetricTrigger(); + scaleRuleInstance.setMetricTrigger(metricTriggerInstance); + + JsonNode nameValue2 = metricTriggerValue.get("Name"); + if (nameValue2 != null) + { + String nameInstance2; + nameInstance2 = nameValue2.getTextValue(); + metricTriggerInstance.setName(nameInstance2); + } + + JsonNode namespaceValue = metricTriggerValue.get("Namespace"); + if (namespaceValue != null) + { + String namespaceInstance; + namespaceInstance = namespaceValue.getTextValue(); + metricTriggerInstance.setNamespace(namespaceInstance); + } + + JsonNode resourceValue = metricTriggerValue.get("Resource"); + if (resourceValue != null) + { + String resourceInstance; + resourceInstance = resourceValue.getTextValue(); + metricTriggerInstance.setResource(resourceInstance); + } + + JsonNode timeGrainValue = metricTriggerValue.get("TimeGrain"); + if (timeGrainValue != null) + { + String timeGrainInstance; + timeGrainInstance = timeGrainValue.getTextValue(); + metricTriggerInstance.setTimeGrain(timeGrainInstance); + } + + JsonNode statisticValue = metricTriggerValue.get("Statistic"); + if (statisticValue != null) + { + MetricStatisticType statisticInstance; + statisticInstance = MetricStatisticType.valueOf(statisticValue.getTextValue()); + metricTriggerInstance.setStatistic(statisticInstance); + } + + JsonNode timeWindowValue = metricTriggerValue.get("TimeWindow"); + if (timeWindowValue != null) + { + String timeWindowInstance; + timeWindowInstance = timeWindowValue.getTextValue(); + metricTriggerInstance.setTimeWindow(timeWindowInstance); + } + + JsonNode timeAggregationValue = metricTriggerValue.get("TimeAggregation"); + if (timeAggregationValue != null) + { + TimeAggregationType timeAggregationInstance; + timeAggregationInstance = TimeAggregationType.valueOf(timeAggregationValue.getTextValue()); + metricTriggerInstance.setTimeAggregation(timeAggregationInstance); + } + + JsonNode operatorValue = metricTriggerValue.get("Operator"); + if (operatorValue != null) + { + ComparisonOperationType operatorInstance; + operatorInstance = ComparisonOperationType.valueOf(operatorValue.getTextValue()); + metricTriggerInstance.setOperator(operatorInstance); + } + + JsonNode thresholdValue = metricTriggerValue.get("Threshold"); + if (thresholdValue != null) + { + double thresholdInstance; + thresholdInstance = thresholdValue.getDoubleValue(); + metricTriggerInstance.setThreshold(thresholdInstance); + } + } + + JsonNode scaleActionValue = rulesValue.get("ScaleAction"); + if (scaleActionValue != null) + { + ScaleAction scaleActionInstance = new ScaleAction(); + scaleRuleInstance.setScaleAction(scaleActionInstance); + + JsonNode directionValue = scaleActionValue.get("Direction"); + if (directionValue != null) + { + ScaleDirection directionInstance; + directionInstance = ScaleDirection.valueOf(directionValue.getTextValue()); + scaleActionInstance.setDirection(directionInstance); + } + + JsonNode typeValue = scaleActionValue.get("Type"); + if (typeValue != null) + { + ScaleType typeInstance; + typeInstance = ScaleType.valueOf(typeValue.getTextValue()); + scaleActionInstance.setType(typeInstance); + } + + JsonNode valueValue = scaleActionValue.get("Value"); + if (valueValue != null) + { + String valueInstance; + valueInstance = valueValue.getTextValue(); + scaleActionInstance.setValue(valueInstance); + } + + JsonNode cooldownValue = scaleActionValue.get("Cooldown"); + if (cooldownValue != null) + { + String cooldownInstance; + cooldownInstance = cooldownValue.getTextValue(); + scaleActionInstance.setCooldown(cooldownInstance); + } + } + } + } + + JsonNode fixedDateValue = profilesValue.get("FixedDate"); + if (fixedDateValue != null) + { + TimeWindow fixedDateInstance = new TimeWindow(); + autoscaleProfileInstance.setFixedDate(fixedDateInstance); + + JsonNode timeZoneValue = fixedDateValue.get("TimeZone"); + if (timeZoneValue != null) + { + String timeZoneInstance; + timeZoneInstance = timeZoneValue.getTextValue(); + fixedDateInstance.setTimeZone(timeZoneInstance); + } + + JsonNode startValue = fixedDateValue.get("Start"); + if (startValue != null) + { + Calendar startInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(startValue.getTextValue())); + startInstance = calendar; + fixedDateInstance.setStart(startInstance); + } + + JsonNode endValue = fixedDateValue.get("End"); + if (endValue != null) + { + Calendar endInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(endValue.getTextValue())); + endInstance = calendar2; + fixedDateInstance.setEnd(endInstance); + } + } + + JsonNode recurrenceValue = profilesValue.get("Recurrence"); + if (recurrenceValue != null) + { + Recurrence recurrenceInstance = new Recurrence(); + autoscaleProfileInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue.get("Frequency"); + if (frequencyValue != null) + { + RecurrenceFrequency frequencyInstance; + frequencyInstance = RecurrenceFrequency.valueOf(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode scheduleValue = recurrenceValue.get("Schedule"); + if (scheduleValue != null) + { + RecurrentSchedule scheduleInstance = new RecurrentSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + JsonNode timeZoneValue2 = scheduleValue.get("TimeZone"); + if (timeZoneValue2 != null) + { + String timeZoneInstance2; + timeZoneInstance2 = timeZoneValue2.getTextValue(); + scheduleInstance.setTimeZone(timeZoneInstance2); + } + + ArrayNode daysArray = ((ArrayNode)scheduleValue.get("Days")); + if (daysArray != null) + { + for (JsonNode daysValue : daysArray) + { + scheduleInstance.getDays().add(daysValue.getTextValue()); + } + } + + ArrayNode hoursArray = ((ArrayNode)scheduleValue.get("Hours")); + if (hoursArray != null) + { + for (JsonNode hoursValue : hoursArray) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode minutesArray = ((ArrayNode)scheduleValue.get("Minutes")); + if (minutesArray != null) + { + for (JsonNode minutesValue : minutesArray) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + } + } + } + } + + JsonNode subscriptionIdValue = responseDoc.get("SubscriptionId"); + if (subscriptionIdValue != null) + { + String subscriptionIdInstance; + subscriptionIdInstance = subscriptionIdValue.getTextValue(); + settingInstance.setSubscriptionId(subscriptionIdInstance); + } + + JsonNode sourceValue = responseDoc.get("Source"); + if (sourceValue != null) + { + String sourceInstance; + sourceInstance = sourceValue.getTextValue(); + settingInstance.setSource(sourceInstance); + } + + JsonNode enabledValue = responseDoc.get("Enabled"); + if (enabledValue != null) + { + boolean enabledInstance; + enabledInstance = enabledValue.getBooleanValue(); + settingInstance.setEnabled(enabledInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleProfile.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleProfile.java new file mode 100644 index 000000000000..6db0bed7d4ad --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleProfile.java @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +import java.util.ArrayList; + +/** +* Autoscale profile. +*/ +public class AutoscaleProfile +{ + private ScaleCapacity capacity; + + /** + * The number of instances that can be used in the scaling action. + */ + public ScaleCapacity getCapacity() { return this.capacity; } + + /** + * The number of instances that can be used in the scaling action. + */ + public void setCapacity(ScaleCapacity capacity) { this.capacity = capacity; } + + private TimeWindow fixedDate; + + /** + * A specific date for the scaling action. This element is not used if the + * Recurrence element is used. + */ + public TimeWindow getFixedDate() { return this.fixedDate; } + + /** + * A specific date for the scaling action. This element is not used if the + * Recurrence element is used. + */ + public void setFixedDate(TimeWindow fixedDate) { this.fixedDate = fixedDate; } + + private String name; + + /** + * The name of the profile. + */ + public String getName() { return this.name; } + + /** + * The name of the profile. + */ + public void setName(String name) { this.name = name; } + + private Recurrence recurrence; + + /** + * The frequency and schedule for the scaling action. This element is not + * used if the FixedDate element is used. + */ + public Recurrence getRecurrence() { return this.recurrence; } + + /** + * The frequency and schedule for the scaling action. This element is not + * used if the FixedDate element is used. + */ + public void setRecurrence(Recurrence recurrence) { this.recurrence = recurrence; } + + private ArrayList rules; + + /** + * A collection of rules that provide the triggers and parameters for the + * scaling action. + */ + public ArrayList getRules() { return this.rules; } + + /** + * A collection of rules that provide the triggers and parameters for the + * scaling action. + */ + public void setRules(ArrayList rules) { this.rules = rules; } + + /** + * Initializes a new instance of the AutoscaleProfile class. + * + */ + public AutoscaleProfile() + { + this.rules = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSetting.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSetting.java new file mode 100644 index 000000000000..a439ea76085c --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSetting.java @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +import java.util.ArrayList; + +/** +* Autoscale setting. +*/ +public class AutoscaleSetting +{ + private boolean enabled; + + public boolean getEnabled() { return this.enabled; } + + public void setEnabled(boolean enabled) { this.enabled = enabled; } + + private ArrayList profiles; + + public ArrayList getProfiles() { return this.profiles; } + + public void setProfiles(ArrayList profiles) { this.profiles = profiles; } + + private String source; + + public String getSource() { return this.source; } + + public void setSource(String source) { this.source = source; } + + private String subscriptionId; + + public String getSubscriptionId() { return this.subscriptionId; } + + public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } + + /** + * Initializes a new instance of the AutoscaleSetting class. + * + */ + public AutoscaleSetting() + { + this.profiles = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingCreateOrUpdateParameters.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingCreateOrUpdateParameters.java new file mode 100644 index 000000000000..f995e5da10b9 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingCreateOrUpdateParameters.java @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +/** +* Parameters supplied to the Create or Update autoscale setting operation. +*/ +public class AutoscaleSettingCreateOrUpdateParameters +{ + private AutoscaleSetting setting; + + /** + * The setting to create or update. + */ + public AutoscaleSetting getSetting() { return this.setting; } + + /** + * The setting to create or update. + */ + public void setSetting(AutoscaleSetting setting) { this.setting = setting; } + + /** + * Initializes a new instance of the + * AutoscaleSettingCreateOrUpdateParameters class. + * + */ + public AutoscaleSettingCreateOrUpdateParameters() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingGetResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingGetResponse.java new file mode 100644 index 000000000000..4a67371bcabc --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/AutoscaleSettingGetResponse.java @@ -0,0 +1,44 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* A standard service response including an HTTP status code and request ID. +*/ +public class AutoscaleSettingGetResponse extends OperationResponse +{ + private AutoscaleSetting setting; + + public AutoscaleSetting getSetting() { return this.setting; } + + public void setSetting(AutoscaleSetting setting) { this.setting = setting; } + + /** + * Initializes a new instance of the AutoscaleSettingGetResponse class. + * + */ + public AutoscaleSettingGetResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ComparisonOperationType.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ComparisonOperationType.java new file mode 100644 index 000000000000..705a19b3a5ea --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ComparisonOperationType.java @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum ComparisonOperationType +{ + Equals, + + NotEquals, + + GreaterThan, + + GreaterThanOrEqual, + + LessThan, + + LessThanOrEqual, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricStatisticType.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricStatisticType.java new file mode 100644 index 000000000000..76343960c807 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricStatisticType.java @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum MetricStatisticType +{ + Average, + + Min, + + Max, + + Sum, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricTrigger.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricTrigger.java new file mode 100644 index 000000000000..a4eee0fc5f84 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/MetricTrigger.java @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +/** +* A rule that provides the triggers and parameters for the scaling action. +*/ +public class MetricTrigger +{ + private String name; + + /** + * The name of the trigger. + */ + public String getName() { return this.name; } + + /** + * The name of the trigger. + */ + public void setName(String name) { this.name = name; } + + private String namespace; + + /** + * A namespace identifier for the service in which the deployment is running. + */ + public String getNamespace() { return this.namespace; } + + /** + * A namespace identifier for the service in which the deployment is running. + */ + public void setNamespace(String namespace) { this.namespace = namespace; } + + private ComparisonOperationType operator; + + /** + * The operator that is used to evaluate the metric. + */ + public ComparisonOperationType getOperator() { return this.operator; } + + /** + * The operator that is used to evaluate the metric. + */ + public void setOperator(ComparisonOperationType operator) { this.operator = operator; } + + private String resource; + + /** + * The resource path of the deployment. + */ + public String getResource() { return this.resource; } + + /** + * The resource path of the deployment. + */ + public void setResource(String resource) { this.resource = resource; } + + private MetricStatisticType statistic; + + /** + * How the metrics from multiple instances are combined. + */ + public MetricStatisticType getStatistic() { return this.statistic; } + + /** + * How the metrics from multiple instances are combined. + */ + public void setStatistic(MetricStatisticType statistic) { this.statistic = statistic; } + + private double threshold; + + /** + * The percentage of usage that triggers the scaling operation. + */ + public double getThreshold() { return this.threshold; } + + /** + * The percentage of usage that triggers the scaling operation. + */ + public void setThreshold(double threshold) { this.threshold = threshold; } + + private TimeAggregationType timeAggregation; + + /** + * How the data that is collected should be combined over time. + */ + public TimeAggregationType getTimeAggregation() { return this.timeAggregation; } + + /** + * How the data that is collected should be combined over time. + */ + public void setTimeAggregation(TimeAggregationType timeAggregation) { this.timeAggregation = timeAggregation; } + + private String timeGrain; + + /** + * The frequency of data collection. + */ + public String getTimeGrain() { return this.timeGrain; } + + /** + * The frequency of data collection. + */ + public void setTimeGrain(String timeGrain) { this.timeGrain = timeGrain; } + + private String timeWindow; + + /** + * The range of time in which instance data is collected. + */ + public String getTimeWindow() { return this.timeWindow; } + + /** + * The range of time in which instance data is collected. + */ + public void setTimeWindow(String timeWindow) { this.timeWindow = timeWindow; } + + /** + * Initializes a new instance of the MetricTrigger class. + * + */ + public MetricTrigger() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/Recurrence.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/Recurrence.java new file mode 100644 index 000000000000..3da16b5c526e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/Recurrence.java @@ -0,0 +1,45 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public class Recurrence +{ + private RecurrenceFrequency frequency; + + public RecurrenceFrequency getFrequency() { return this.frequency; } + + public void setFrequency(RecurrenceFrequency frequency) { this.frequency = frequency; } + + private RecurrentSchedule schedule; + + public RecurrentSchedule getSchedule() { return this.schedule; } + + public void setSchedule(RecurrentSchedule schedule) { this.schedule = schedule; } + + /** + * Initializes a new instance of the Recurrence class. + * + */ + public Recurrence() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrenceFrequency.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrenceFrequency.java new file mode 100644 index 000000000000..2afa31a159e7 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrenceFrequency.java @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum RecurrenceFrequency +{ + /** + * No recurrence + */ + None, + + /** + * A recurrence value measured in seconds. + */ + Second, + + /** + * A recurrence value measured in minutes. + */ + Minute, + + /** + * A recurrence value measured in hours. + */ + Hour, + + /** + * A recurrence value measured in days. + */ + Day, + + /** + * A recurrence value measured in weeks. + */ + Week, + + /** + * A recurrence value measured in months. + */ + Month, + + /** + * A recurrence value measured in years. + */ + Year, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrentSchedule.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrentSchedule.java new file mode 100644 index 000000000000..97b5576c9798 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/RecurrentSchedule.java @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +import java.util.ArrayList; + +public class RecurrentSchedule +{ + private ArrayList days; + + public ArrayList getDays() { return this.days; } + + public void setDays(ArrayList days) { this.days = days; } + + private ArrayList hours; + + public ArrayList getHours() { return this.hours; } + + public void setHours(ArrayList hours) { this.hours = hours; } + + private ArrayList minutes; + + public ArrayList getMinutes() { return this.minutes; } + + public void setMinutes(ArrayList minutes) { this.minutes = minutes; } + + private String timeZone; + + public String getTimeZone() { return this.timeZone; } + + public void setTimeZone(String timeZone) { this.timeZone = timeZone; } + + /** + * Initializes a new instance of the RecurrentSchedule class. + * + */ + public RecurrentSchedule() + { + this.days = new ArrayList(); + this.hours = new ArrayList(); + this.minutes = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleAction.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleAction.java new file mode 100644 index 000000000000..8e14372c15f5 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleAction.java @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +/** +* The action for scaling. +*/ +public class ScaleAction +{ + private String cooldown; + + /** + * The cooldown interval for scaling action. + */ + public String getCooldown() { return this.cooldown; } + + /** + * The cooldown interval for scaling action. + */ + public void setCooldown(String cooldown) { this.cooldown = cooldown; } + + private ScaleDirection direction; + + /** + * The direction of scaling. + */ + public ScaleDirection getDirection() { return this.direction; } + + /** + * The direction of scaling. + */ + public void setDirection(ScaleDirection direction) { this.direction = direction; } + + private ScaleType type; + + /** + * The type of scaling. + */ + public ScaleType getType() { return this.type; } + + /** + * The type of scaling. + */ + public void setType(ScaleType type) { this.type = type; } + + private String value; + + /** + * The rate of scaling. + */ + public String getValue() { return this.value; } + + /** + * The rate of scaling. + */ + public void setValue(String value) { this.value = value; } + + /** + * Initializes a new instance of the ScaleAction class. + * + */ + public ScaleAction() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleCapacity.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleCapacity.java new file mode 100644 index 000000000000..4debe1f9f02c --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleCapacity.java @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +/** +* The number of instances that can be used in the scaling action. +*/ +public class ScaleCapacity +{ + private String defaultValue; + + /** + * The default number of instances that are available for the scaling action. + */ + public String getDefault() { return this.defaultValue; } + + /** + * The default number of instances that are available for the scaling action. + */ + public void setDefault(String defaultValue) { this.defaultValue = defaultValue; } + + private String maximum; + + /** + * The maximum number of instances that are available for the scaling action. + */ + public String getMaximum() { return this.maximum; } + + /** + * The maximum number of instances that are available for the scaling action. + */ + public void setMaximum(String maximum) { this.maximum = maximum; } + + private String minimum; + + /** + * The minimum number of instances that are available for the scaling action. + */ + public String getMinimum() { return this.minimum; } + + /** + * The minimum number of instances that are available for the scaling action. + */ + public void setMinimum(String minimum) { this.minimum = minimum; } + + /** + * Initializes a new instance of the ScaleCapacity class. + * + */ + public ScaleCapacity() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleDirection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleDirection.java new file mode 100644 index 000000000000..237dac5bcc4a --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleDirection.java @@ -0,0 +1,40 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum ScaleDirection +{ + /** + * Do nothing. + */ + None, + + /** + * Increase capacity. + */ + Increase, + + /** + * Decrease capacity. + */ + Decrease, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleRule.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleRule.java new file mode 100644 index 000000000000..7aaf436c2482 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleRule.java @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +/** +* A rule that provide the triggers and parameters for the scaling action. +*/ +public class ScaleRule +{ + private MetricTrigger metricTrigger; + + /** + * The metrics that are used to determine when a scaling action occurs. + */ + public MetricTrigger getMetricTrigger() { return this.metricTrigger; } + + /** + * The metrics that are used to determine when a scaling action occurs. + */ + public void setMetricTrigger(MetricTrigger metricTrigger) { this.metricTrigger = metricTrigger; } + + private ScaleAction scaleAction; + + /** + * The parameters for the scaling action. + */ + public ScaleAction getScaleAction() { return this.scaleAction; } + + /** + * The parameters for the scaling action. + */ + public void setScaleAction(ScaleAction scaleAction) { this.scaleAction = scaleAction; } + + /** + * Initializes a new instance of the ScaleRule class. + * + */ + public ScaleRule() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleType.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleType.java new file mode 100644 index 000000000000..77283f73349b --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/ScaleType.java @@ -0,0 +1,45 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum ScaleType +{ + /** + * The change size. + */ + ChangeSize, + + /** + * The change count. + */ + ChangeCount, + + /** + * The percent change count. + */ + PercentChangeCount, + + /** + * The exact count. + */ + ExactCount, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeAggregationType.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeAggregationType.java new file mode 100644 index 000000000000..bc99bd9158fc --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeAggregationType.java @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +public enum TimeAggregationType +{ + Average, + + Minimum, + + Maximum, + + Last, + + Total, + + Count, +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeWindow.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeWindow.java new file mode 100644 index 000000000000..0d461c5e8df2 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/models/TimeWindow.java @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.autoscale.models; + +import java.util.Calendar; + +/** +* The action for scaling. +*/ +public class TimeWindow +{ + private Calendar end; + + /** + * The end of the time window. + */ + public Calendar getEnd() { return this.end; } + + /** + * The end of the time window. + */ + public void setEnd(Calendar end) { this.end = end; } + + private Calendar start; + + /** + * The start of the time window. + */ + public Calendar getStart() { return this.start; } + + /** + * The start of the time window. + */ + public void setStart(Calendar start) { this.start = start; } + + private String timeZone; + + /** + * The time zone information. + */ + public String getTimeZone() { return this.timeZone; } + + /** + * The time zone information. + */ + public void setTimeZone(String timeZone) { this.timeZone = timeZone; } + + /** + * Initializes a new instance of the TimeWindow class. + * + */ + public TimeWindow() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/package.html b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/package.html new file mode 100644 index 000000000000..e8dfd96862b7 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/autoscale/package.html @@ -0,0 +1,6 @@ + + +This package contains the service management class, + interface, and associated configuration and utility classes. + + diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/Exports.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/Exports.java new file mode 100644 index 000000000000..a7299b0148bd --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/Exports.java @@ -0,0 +1,33 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.services.core.Builder; + +/** + * The Class Exports. + */ +public class Exports implements Builder.Exports { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.Builder.Exports#register(com.microsoft.windowsazure.services.core.Builder.Registry) + */ + @Override + public void register(Builder.Registry registry) { + + // provide contract implementation + registry.add(MetricsClient.class, MetricsClientImpl.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperations.java new file mode 100644 index 000000000000..3fbc84b0ab9e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperations.java @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricDefinitionListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.concurrent.Future; + +public interface MetricDefinitionOperations +{ + /** + * The List Metric Definitions operation lists the metric definitions for + * the resource. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @return The List Metric Definitions operation response. + */ + MetricDefinitionListResponse list(String resourceId, ArrayList metricNames, String metricNamespace) throws IOException, ServiceException, URISyntaxException, ParseException; + + /** + * The List Metric Definitions operation lists the metric definitions for + * the resource. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @return The List Metric Definitions operation response. + */ + Future listAsync(String resourceId, ArrayList metricNames, String metricNamespace); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperationsImpl.java new file mode 100644 index 000000000000..0dcf1e580d1e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricDefinitionOperationsImpl.java @@ -0,0 +1,259 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricAvailability; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricDefinition; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricDefinitionCollection; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricDefinitionListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.TimeSpan8601Converter; +import com.microsoft.windowsazure.services.core.utils.CommaStringBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.xml.datatype.Duration; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; + +public class MetricDefinitionOperationsImpl implements ServiceOperations, MetricDefinitionOperations +{ + /** + * Initializes a new instance of the MetricDefinitionOperationsImpl class. + * + * @param client Reference to the service client. + */ + MetricDefinitionOperationsImpl(MetricsClientImpl client) + { + this.client = client; + } + + private MetricsClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.metrics.MetricsClientImpl. + */ + public MetricsClientImpl getClient() { return this.client; } + + /** + * The List Metric Definitions operation lists the metric definitions for + * the resource. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @return The List Metric Definitions operation response. + */ + @Override + public Future listAsync(final String resourceId, final ArrayList metricNames, final String metricNamespace) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public MetricDefinitionListResponse call() throws Exception + { + return list(resourceId, metricNames, metricNamespace); + } + }); + } + + /** + * The List Metric Definitions operation lists the metric definitions for + * the resource. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @return The List Metric Definitions operation response. + */ + @Override + public MetricDefinitionListResponse list(String resourceId, ArrayList metricNames, String metricNamespace) throws IOException, ServiceException, URISyntaxException, ParseException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/metricdefinitions/query?"; + url = url + "&resourceId=" + URLEncoder.encode(resourceId); + if (metricNamespace != null) + { + url = url + "&namespace=" + URLEncoder.encode(metricNamespace); + } + if (metricNames != null && metricNames.size() > 0) + { + url = url + "&names=" + URLEncoder.encode(CommaStringBuilder.join(metricNames)); + } + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + MetricDefinitionListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new MetricDefinitionListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + MetricDefinitionCollection metricDefinitionCollectionInstance = new MetricDefinitionCollection(); + result.setMetricDefinitionCollection(metricDefinitionCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + MetricDefinition metricDefinitionInstance = new MetricDefinition(); + metricDefinitionCollectionInstance.getValue().add(metricDefinitionInstance); + + JsonNode nameValue = valueValue.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + metricDefinitionInstance.setName(nameInstance); + } + + JsonNode namespaceValue = valueValue.get("Namespace"); + if (namespaceValue != null) + { + String namespaceInstance; + namespaceInstance = namespaceValue.getTextValue(); + metricDefinitionInstance.setNamespace(namespaceInstance); + } + + JsonNode resourceIdSuffixValue = valueValue.get("ResourceIdSuffix"); + if (resourceIdSuffixValue != null) + { + String resourceIdSuffixInstance; + resourceIdSuffixInstance = resourceIdSuffixValue.getTextValue(); + metricDefinitionInstance.setResourceIdSuffix(resourceIdSuffixInstance); + } + + JsonNode displayNameValue = valueValue.get("DisplayName"); + if (displayNameValue != null) + { + String displayNameInstance; + displayNameInstance = displayNameValue.getTextValue(); + metricDefinitionInstance.setDisplayName(displayNameInstance); + } + + JsonNode unitValue = valueValue.get("Unit"); + if (unitValue != null) + { + String unitInstance; + unitInstance = unitValue.getTextValue(); + metricDefinitionInstance.setUnit(unitInstance); + } + + JsonNode primaryAggregationValue = valueValue.get("PrimaryAggregation"); + if (primaryAggregationValue != null) + { + String primaryAggregationInstance; + primaryAggregationInstance = primaryAggregationValue.getTextValue(); + metricDefinitionInstance.setPrimaryAggregation(primaryAggregationInstance); + } + + ArrayNode metricAvailabilitiesArray = ((ArrayNode)valueValue.get("MetricAvailabilities")); + if (metricAvailabilitiesArray != null) + { + for (JsonNode metricAvailabilitiesValue : metricAvailabilitiesArray) + { + MetricAvailability metricAvailabilityInstance = new MetricAvailability(); + metricDefinitionInstance.getMetricAvailabilities().add(metricAvailabilityInstance); + + JsonNode timeGrainValue = metricAvailabilitiesValue.get("TimeGrain"); + if (timeGrainValue != null) + { + Duration timeGrainInstance; + timeGrainInstance = TimeSpan8601Converter.parse(timeGrainValue.getTextValue()); + metricAvailabilityInstance.setTimeGrain(timeGrainInstance); + } + + JsonNode retentionValue = metricAvailabilitiesValue.get("Retention"); + if (retentionValue != null) + { + Duration retentionInstance; + retentionInstance = TimeSpan8601Converter.parse(retentionValue.getTextValue()); + metricAvailabilityInstance.setRetention(retentionInstance); + } + } + } + + JsonNode minimumAlertableTimeWindowValue = valueValue.get("MinimumAlertableTimeWindow"); + if (minimumAlertableTimeWindowValue != null) + { + Duration minimumAlertableTimeWindowInstance; + minimumAlertableTimeWindowInstance = TimeSpan8601Converter.parse(minimumAlertableTimeWindowValue.getTextValue()); + metricDefinitionInstance.setMinimumAlertableTimeWindow(minimumAlertableTimeWindowInstance); + } + + JsonNode isAlertableValue = valueValue.get("IsAlertable"); + if (isAlertableValue != null) + { + boolean isAlertableInstance; + isAlertableInstance = isAlertableValue.getBooleanValue(); + metricDefinitionInstance.setIsAlertable(isAlertableInstance); + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperations.java new file mode 100644 index 000000000000..3c7ae68d2b2e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperations.java @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSettingListResponse; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSettingsPutParameters; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.util.concurrent.Future; + +public interface MetricSettingOperations +{ + /** + * The Put Metric Settings operation creates or updates the metric settings + * for the resource. + * + * @param parameters Metric settings to be created or updated. + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse createOrUpdate(MetricSettingsPutParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException; + + /** + * The Put Metric Settings operation creates or updates the metric settings + * for the resource. + * + * @param parameters Metric settings to be created or updated. + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future createOrUpdateAsync(MetricSettingsPutParameters parameters); + + /** + * The List Metric Settings operation lists the metric settings for the + * resource. + * + * @param resourceId The id of the resource. + * @param metricNamespace The namespace of the metrics. + * @return The list metric settings operation response. + */ + MetricSettingListResponse list(String resourceId, String metricNamespace) throws IOException, ServiceException, URISyntaxException, ParseException; + + /** + * The List Metric Settings operation lists the metric settings for the + * resource. + * + * @param resourceId The id of the resource. + * @param metricNamespace The namespace of the metrics. + * @return The list metric settings operation response. + */ + Future listAsync(String resourceId, String metricNamespace); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperationsImpl.java new file mode 100644 index 000000000000..2e1d0bdd754b --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricSettingOperationsImpl.java @@ -0,0 +1,535 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.monitoring.metrics.models.AvailabilityMetricSettingValue; +import com.microsoft.windowsazure.management.monitoring.metrics.models.EndpointConfig; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSetting; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSettingCollection; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSettingListResponse; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricSettingsPutParameters; +import com.microsoft.windowsazure.management.monitoring.metrics.models.NameConfig; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.StringEntity; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; + +public class MetricSettingOperationsImpl implements ServiceOperations, MetricSettingOperations +{ + /** + * Initializes a new instance of the MetricSettingOperationsImpl class. + * + * @param client Reference to the service client. + */ + MetricSettingOperationsImpl(MetricsClientImpl client) + { + this.client = client; + } + + private MetricsClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.metrics.MetricsClientImpl. + */ + public MetricsClientImpl getClient() { return this.client; } + + /** + * The Put Metric Settings operation creates or updates the metric settings + * for the resource. + * + * @param parameters Metric settings to be created or updated. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future createOrUpdateAsync(final MetricSettingsPutParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return createOrUpdate(parameters); + } + }); + } + + /** + * The Put Metric Settings operation creates or updates the metric settings + * for the resource. + * + * @param parameters Metric settings to be created or updated. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse createOrUpdate(MetricSettingsPutParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException + { + // Validate + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + if (parameters.getMetricSetting() == null) + { + throw new NullPointerException("parameters.MetricSetting"); + } + if (parameters.getMetricSetting().getResourceId() == null) + { + throw new NullPointerException("parameters.MetricSetting.ResourceId"); + } + if (parameters.getMetricSetting().getValue() == null) + { + throw new NullPointerException("parameters.MetricSetting.Value"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/metricsettings"; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode metricSettingValue = objectMapper.createObjectNode(); + requestDoc = metricSettingValue; + + metricSettingValue.put("ResourceId", parameters.getMetricSetting().getResourceId()); + + if (parameters.getMetricSetting().getNamespace() != null) + { + metricSettingValue.put("Namespace", parameters.getMetricSetting().getNamespace()); + } + + ObjectNode valueValue = objectMapper.createObjectNode(); + metricSettingValue.put("Value", valueValue); + valueValue.put("odata.type", parameters.getMetricSetting().getValue().getClass().getName()); + if (parameters.getMetricSetting().getValue().getClass().isInstance(AvailabilityMetricSettingValue.class)) + { + AvailabilityMetricSettingValue derived = ((AvailabilityMetricSettingValue)parameters.getMetricSetting().getValue()); + + if (derived.getAvailableLocations() != null) + { + ArrayNode availableLocationsArray = objectMapper.createArrayNode(); + for (NameConfig availableLocationsItem : derived.getAvailableLocations()) + { + ObjectNode nameConfigValue = objectMapper.createObjectNode(); + availableLocationsArray.add(nameConfigValue); + + if (availableLocationsItem.getName() != null) + { + nameConfigValue.put("Name", availableLocationsItem.getName()); + } + + if (availableLocationsItem.getDisplayName() != null) + { + nameConfigValue.put("DisplayName", availableLocationsItem.getDisplayName()); + } + } + valueValue.put("AvailableLocations", availableLocationsArray); + } + + if (derived.getDefaultMetrics() != null) + { + ArrayNode defaultMetricsArray = objectMapper.createArrayNode(); + for (NameConfig defaultMetricsItem : derived.getDefaultMetrics()) + { + ObjectNode nameConfigValue2 = objectMapper.createObjectNode(); + defaultMetricsArray.add(nameConfigValue2); + + if (defaultMetricsItem.getName() != null) + { + nameConfigValue2.put("Name", defaultMetricsItem.getName()); + } + + if (defaultMetricsItem.getDisplayName() != null) + { + nameConfigValue2.put("DisplayName", defaultMetricsItem.getDisplayName()); + } + } + valueValue.put("DefaultMetrics", defaultMetricsArray); + } + + if (derived.getAvailabilityMetrics() != null) + { + ArrayNode availabilityMetricsArray = objectMapper.createArrayNode(); + for (NameConfig availabilityMetricsItem : derived.getAvailabilityMetrics()) + { + ObjectNode nameConfigValue3 = objectMapper.createObjectNode(); + availabilityMetricsArray.add(nameConfigValue3); + + if (availabilityMetricsItem.getName() != null) + { + nameConfigValue3.put("Name", availabilityMetricsItem.getName()); + } + + if (availabilityMetricsItem.getDisplayName() != null) + { + nameConfigValue3.put("DisplayName", availabilityMetricsItem.getDisplayName()); + } + } + valueValue.put("AvailabilityMetrics", availabilityMetricsArray); + } + + if (derived.getEndpoints() != null) + { + ArrayNode endpointsArray = objectMapper.createArrayNode(); + for (EndpointConfig endpointsItem : derived.getEndpoints()) + { + ObjectNode endpointConfigValue = objectMapper.createObjectNode(); + endpointsArray.add(endpointConfigValue); + + if (endpointsItem.getConfigId() != null) + { + endpointConfigValue.put("ConfigId", endpointsItem.getConfigId()); + } + + if (endpointsItem.getName() != null) + { + endpointConfigValue.put("Name", endpointsItem.getName()); + } + + if (endpointsItem.getLocation() != null) + { + endpointConfigValue.put("Location", endpointsItem.getLocation()); + } + + if (endpointsItem.getUrl() != null) + { + endpointConfigValue.put("Url", endpointsItem.getUrl().toString()); + } + + endpointConfigValue.put("TestIntervalInSeconds", endpointsItem.getTestIntervalInSeconds()); + } + valueValue.put("Endpoints", endpointsArray); + } + } + + StringWriter stringWriter = new StringWriter(); + objectMapper.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * The List Metric Settings operation lists the metric settings for the + * resource. + * + * @param resourceId The id of the resource. + * @param metricNamespace The namespace of the metrics. + * @return The list metric settings operation response. + */ + @Override + public Future listAsync(final String resourceId, final String metricNamespace) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public MetricSettingListResponse call() throws Exception + { + return list(resourceId, metricNamespace); + } + }); + } + + /** + * The List Metric Settings operation lists the metric settings for the + * resource. + * + * @param resourceId The id of the resource. + * @param metricNamespace The namespace of the metrics. + * @return The list metric settings operation response. + */ + @Override + public MetricSettingListResponse list(String resourceId, String metricNamespace) throws IOException, ServiceException, URISyntaxException, ParseException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + if (metricNamespace == null) + { + throw new NullPointerException("metricNamespace"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/metricsettings?"; + url = url + "&resourceId=" + URLEncoder.encode(resourceId); + url = url + "&namespace=" + URLEncoder.encode(metricNamespace); + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + MetricSettingListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new MetricSettingListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + MetricSettingCollection metricSettingCollectionInstance = new MetricSettingCollection(); + result.setMetricSettingCollection(metricSettingCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + MetricSetting metricSettingInstance = new MetricSetting(); + metricSettingCollectionInstance.getValue().add(metricSettingInstance); + + JsonNode resourceIdValue = valueValue.get("ResourceId"); + if (resourceIdValue != null) + { + String resourceIdInstance; + resourceIdInstance = resourceIdValue.getTextValue(); + metricSettingInstance.setResourceId(resourceIdInstance); + } + + JsonNode namespaceValue = valueValue.get("Namespace"); + if (namespaceValue != null) + { + String namespaceInstance; + namespaceInstance = namespaceValue.getTextValue(); + metricSettingInstance.setNamespace(namespaceInstance); + } + + JsonNode valueValue2 = valueValue.get("Value"); + if (valueValue2 != null) + { + String typeName = valueValue2.get("odata.type").getTextValue(); + if (typeName == "Microsoft.WindowsAzure.Management.Monitoring.Metrics.Models.AvailabilityMetricSettingValue") + { + AvailabilityMetricSettingValue availabilityMetricSettingValueInstance = new AvailabilityMetricSettingValue(); + + ArrayNode availableLocationsArray = ((ArrayNode)valueValue2.get("AvailableLocations")); + if (availableLocationsArray != null) + { + for (JsonNode availableLocationsValue : availableLocationsArray) + { + NameConfig nameConfigInstance = new NameConfig(); + availabilityMetricSettingValueInstance.getAvailableLocations().add(nameConfigInstance); + + JsonNode nameValue = availableLocationsValue.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + nameConfigInstance.setName(nameInstance); + } + + JsonNode displayNameValue = availableLocationsValue.get("DisplayName"); + if (displayNameValue != null) + { + String displayNameInstance; + displayNameInstance = displayNameValue.getTextValue(); + nameConfigInstance.setDisplayName(displayNameInstance); + } + } + } + + ArrayNode defaultMetricsArray = ((ArrayNode)valueValue2.get("DefaultMetrics")); + if (defaultMetricsArray != null) + { + for (JsonNode defaultMetricsValue : defaultMetricsArray) + { + NameConfig nameConfigInstance2 = new NameConfig(); + availabilityMetricSettingValueInstance.getDefaultMetrics().add(nameConfigInstance2); + + JsonNode nameValue2 = defaultMetricsValue.get("Name"); + if (nameValue2 != null) + { + String nameInstance2; + nameInstance2 = nameValue2.getTextValue(); + nameConfigInstance2.setName(nameInstance2); + } + + JsonNode displayNameValue2 = defaultMetricsValue.get("DisplayName"); + if (displayNameValue2 != null) + { + String displayNameInstance2; + displayNameInstance2 = displayNameValue2.getTextValue(); + nameConfigInstance2.setDisplayName(displayNameInstance2); + } + } + } + + ArrayNode availabilityMetricsArray = ((ArrayNode)valueValue2.get("AvailabilityMetrics")); + if (availabilityMetricsArray != null) + { + for (JsonNode availabilityMetricsValue : availabilityMetricsArray) + { + NameConfig nameConfigInstance3 = new NameConfig(); + availabilityMetricSettingValueInstance.getAvailabilityMetrics().add(nameConfigInstance3); + + JsonNode nameValue3 = availabilityMetricsValue.get("Name"); + if (nameValue3 != null) + { + String nameInstance3; + nameInstance3 = nameValue3.getTextValue(); + nameConfigInstance3.setName(nameInstance3); + } + + JsonNode displayNameValue3 = availabilityMetricsValue.get("DisplayName"); + if (displayNameValue3 != null) + { + String displayNameInstance3; + displayNameInstance3 = displayNameValue3.getTextValue(); + nameConfigInstance3.setDisplayName(displayNameInstance3); + } + } + } + + ArrayNode endpointsArray = ((ArrayNode)valueValue2.get("Endpoints")); + if (endpointsArray != null) + { + for (JsonNode endpointsValue : endpointsArray) + { + EndpointConfig endpointConfigInstance = new EndpointConfig(); + availabilityMetricSettingValueInstance.getEndpoints().add(endpointConfigInstance); + + JsonNode configIdValue = endpointsValue.get("ConfigId"); + if (configIdValue != null) + { + String configIdInstance; + configIdInstance = configIdValue.getTextValue(); + endpointConfigInstance.setConfigId(configIdInstance); + } + + JsonNode nameValue4 = endpointsValue.get("Name"); + if (nameValue4 != null) + { + String nameInstance4; + nameInstance4 = nameValue4.getTextValue(); + endpointConfigInstance.setName(nameInstance4); + } + + JsonNode locationValue = endpointsValue.get("Location"); + if (locationValue != null) + { + String locationInstance; + locationInstance = locationValue.getTextValue(); + endpointConfigInstance.setLocation(locationInstance); + } + + JsonNode urlValue = endpointsValue.get("Url"); + if (urlValue != null) + { + URI urlInstance; + urlInstance = new URI(urlValue.getTextValue()); + endpointConfigInstance.setUrl(urlInstance); + } + + JsonNode testIntervalInSecondsValue = endpointsValue.get("TestIntervalInSeconds"); + if (testIntervalInSecondsValue != null) + { + int testIntervalInSecondsInstance; + testIntervalInSecondsInstance = testIntervalInSecondsValue.getIntValue(); + endpointConfigInstance.setTestIntervalInSeconds(testIntervalInSecondsInstance); + } + } + } + metricSettingInstance.setValue(availabilityMetricSettingValueInstance); + } + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperations.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperations.java new file mode 100644 index 000000000000..cf340d7cfb7f --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperations.java @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricValueListResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.concurrent.Future; +import javax.xml.datatype.Duration; + +public interface MetricValueOperations +{ + /** + * The List Metric Value operation lists the metric value sets for the + * resource metrics. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @param timeGrain The time grain of the metrics. + * @param startTime The start time (in UTC) of the metrics. + * @param endTime The end time (in UTC) of the metrics. + * @return The List Metric values operation response. + */ + MetricValueListResponse list(String resourceId, ArrayList metricNames, String metricNamespace, Duration timeGrain, Calendar startTime, Calendar endTime) throws IOException, ServiceException, URISyntaxException, ParseException; + + /** + * The List Metric Value operation lists the metric value sets for the + * resource metrics. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @param timeGrain The time grain of the metrics. + * @param startTime The start time (in UTC) of the metrics. + * @param endTime The end time (in UTC) of the metrics. + * @return The List Metric values operation response. + */ + Future listAsync(String resourceId, ArrayList metricNames, String metricNamespace, Duration timeGrain, Calendar startTime, Calendar endTime); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperationsImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperationsImpl.java new file mode 100644 index 000000000000..6f3d574aeea3 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricValueOperationsImpl.java @@ -0,0 +1,329 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricValue; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricValueListResponse; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricValueSet; +import com.microsoft.windowsazure.management.monitoring.metrics.models.MetricValueSetCollection; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.TimeSpan8601Converter; +import com.microsoft.windowsazure.services.core.utils.CommaStringBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.TimeZone; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.xml.datatype.Duration; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; + +public class MetricValueOperationsImpl implements ServiceOperations, MetricValueOperations +{ + /** + * Initializes a new instance of the MetricValueOperationsImpl class. + * + * @param client Reference to the service client. + */ + MetricValueOperationsImpl(MetricsClientImpl client) + { + this.client = client; + } + + private MetricsClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.monitoring.metrics.MetricsClientImpl. + */ + public MetricsClientImpl getClient() { return this.client; } + + /** + * The List Metric Value operation lists the metric value sets for the + * resource metrics. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @param timeGrain The time grain of the metrics. + * @param startTime The start time (in UTC) of the metrics. + * @param endTime The end time (in UTC) of the metrics. + * @return The List Metric values operation response. + */ + @Override + public Future listAsync(final String resourceId, final ArrayList metricNames, final String metricNamespace, final Duration timeGrain, final Calendar startTime, final Calendar endTime) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public MetricValueListResponse call() throws Exception + { + return list(resourceId, metricNames, metricNamespace, timeGrain, startTime, endTime); + } + }); + } + + /** + * The List Metric Value operation lists the metric value sets for the + * resource metrics. + * + * @param resourceId The id of the resource. + * @param metricNames The names of the metrics. + * @param metricNamespace The namespace of the metrics. + * @param timeGrain The time grain of the metrics. + * @param startTime The start time (in UTC) of the metrics. + * @param endTime The end time (in UTC) of the metrics. + * @return The List Metric values operation response. + */ + @Override + public MetricValueListResponse list(String resourceId, ArrayList metricNames, String metricNamespace, Duration timeGrain, Calendar startTime, Calendar endTime) throws IOException, ServiceException, URISyntaxException, ParseException + { + // Validate + if (resourceId == null) + { + throw new NullPointerException("resourceId"); + } + if (metricNames == null) + { + throw new NullPointerException("metricNames"); + } + if (metricNames.size() <= 0) + { + throw new IllegalArgumentException("metricNames cannot be empty."); + } + + // Tracing + + // Construct URL + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/monitoring/metricvalues/query?"; + url = url + "&resourceId=" + URLEncoder.encode(resourceId); + if (metricNamespace != null) + { + url = url + "&namespace=" + URLEncoder.encode(metricNamespace); + } + url = url + "&names=" + URLEncoder.encode(CommaStringBuilder.join(metricNames)); + url = url + "&timeGrain=" + URLEncoder.encode(TimeSpan8601Converter.format(timeGrain)); + url = url + "&startTime=" + URLEncoder.encode(simpleDateFormat.format(startTime.getTime())); + url = url + "&endTime=" + URLEncoder.encode(simpleDateFormat2.format(endTime.getTime())); + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("Accept", "application/json"); + httpRequest.setHeader("x-ms-version", "2012-08-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + MetricValueListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new MetricValueListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + MetricValueSetCollection metricValueSetCollectionInstance = new MetricValueSetCollection(); + result.setMetricValueSetCollection(metricValueSetCollectionInstance); + + ArrayNode valueArray = ((ArrayNode)responseDoc.get("Value")); + if (valueArray != null) + { + for (JsonNode valueValue : valueArray) + { + MetricValueSet metricValueSetInstance = new MetricValueSet(); + metricValueSetCollectionInstance.getValue().add(metricValueSetInstance); + + JsonNode nameValue = valueValue.get("Name"); + if (nameValue != null) + { + String nameInstance; + nameInstance = nameValue.getTextValue(); + metricValueSetInstance.setName(nameInstance); + } + + JsonNode namespaceValue = valueValue.get("Namespace"); + if (namespaceValue != null) + { + String namespaceInstance; + namespaceInstance = namespaceValue.getTextValue(); + metricValueSetInstance.setNamespace(namespaceInstance); + } + + JsonNode displayNameValue = valueValue.get("DisplayName"); + if (displayNameValue != null) + { + String displayNameInstance; + displayNameInstance = displayNameValue.getTextValue(); + metricValueSetInstance.setDisplayName(displayNameInstance); + } + + JsonNode unitValue = valueValue.get("Unit"); + if (unitValue != null) + { + String unitInstance; + unitInstance = unitValue.getTextValue(); + metricValueSetInstance.setUnit(unitInstance); + } + + JsonNode primaryAggregationValue = valueValue.get("PrimaryAggregation"); + if (primaryAggregationValue != null) + { + String primaryAggregationInstance; + primaryAggregationInstance = primaryAggregationValue.getTextValue(); + metricValueSetInstance.setPrimaryAggregation(primaryAggregationInstance); + } + + JsonNode timeGrainValue = valueValue.get("TimeGrain"); + if (timeGrainValue != null) + { + Duration timeGrainInstance; + timeGrainInstance = TimeSpan8601Converter.parse(timeGrainValue.getTextValue()); + metricValueSetInstance.setTimeGrain(timeGrainInstance); + } + + JsonNode startTimeValue = valueValue.get("StartTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat3.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + metricValueSetInstance.setStartTime(startTimeInstance); + } + + JsonNode endTimeValue = valueValue.get("EndTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat4.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + metricValueSetInstance.setEndTime(endTimeInstance); + } + + ArrayNode metricValuesArray = ((ArrayNode)valueValue.get("MetricValues")); + if (metricValuesArray != null) + { + for (JsonNode metricValuesValue : metricValuesArray) + { + MetricValue metricValueInstance = new MetricValue(); + metricValueSetInstance.getMetricValues().add(metricValueInstance); + + JsonNode timestampValue = metricValuesValue.get("Timestamp"); + if (timestampValue != null) + { + Calendar timestampInstance; + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat5.parse(timestampValue.getTextValue())); + timestampInstance = calendar3; + metricValueInstance.setTimestamp(timestampInstance); + } + + JsonNode averageValue = metricValuesValue.get("Average"); + if (averageValue != null) + { + double averageInstance; + averageInstance = averageValue.getDoubleValue(); + metricValueInstance.setAverage(averageInstance); + } + + JsonNode minimumValue = metricValuesValue.get("Minimum"); + if (minimumValue != null) + { + double minimumInstance; + minimumInstance = minimumValue.getDoubleValue(); + metricValueInstance.setMinimum(minimumInstance); + } + + JsonNode maximumValue = metricValuesValue.get("Maximum"); + if (maximumValue != null) + { + double maximumInstance; + maximumInstance = maximumValue.getDoubleValue(); + metricValueInstance.setMaximum(maximumInstance); + } + + JsonNode totalValue = metricValuesValue.get("Total"); + if (totalValue != null) + { + double totalInstance; + totalInstance = totalValue.getDoubleValue(); + metricValueInstance.setTotal(totalInstance); + } + + JsonNode annotationValue = metricValuesValue.get("Annotation"); + if (annotationValue != null) + { + String annotationInstance; + annotationInstance = annotationValue.getTextValue(); + metricValueInstance.setAnnotation(annotationInstance); + } + + JsonNode countValue = metricValuesValue.get("Count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + metricValueInstance.setCount(countInstance); + } + } + } + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClient.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClient.java new file mode 100644 index 000000000000..19babd4b96f2 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClient.java @@ -0,0 +1,44 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import java.net.URI; + +public interface MetricsClient +{ + /** + * Optional base uri parameter. + */ + URI getBaseUri(); + + /** + * Windows Azure subscription id + */ + SubscriptionCloudCredentials getCredentials(); + + MetricDefinitionOperations getMetricDefinitions(); + + MetricSettingOperations getMetricSettings(); + + MetricValueOperations getMetricValues(); +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClientImpl.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClientImpl.java new file mode 100644 index 000000000000..09359e238916 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsClientImpl.java @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.management.ManagementConfiguration; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.services.core.ServiceClient; +import java.net.URI; +import javax.inject.Inject; +import javax.inject.Named; + +public class MetricsClientImpl extends ServiceClient implements MetricsClient +{ + private URI baseUri; + + /** + * Optional base uri parameter. + */ + public URI getBaseUri() { return this.baseUri; } + + private SubscriptionCloudCredentials credentials; + + /** + * Windows Azure subscription id + */ + public SubscriptionCloudCredentials getCredentials() { return this.credentials; } + + private MetricDefinitionOperations metricDefinitions; + + public MetricDefinitionOperations getMetricDefinitions() { return this.metricDefinitions; } + + private MetricSettingOperations metricSettings; + + public MetricSettingOperations getMetricSettings() { return this.metricSettings; } + + private MetricValueOperations metricValues; + + public MetricValueOperations getMetricValues() { return this.metricValues; } + + /** + * Initializes a new instance of the MetricsClientImpl class. + * + */ + private MetricsClientImpl() + { + super(); + this.metricDefinitions = new MetricDefinitionOperationsImpl(this); + this.metricSettings = new MetricSettingOperationsImpl(this); + this.metricValues = new MetricValueOperationsImpl(this); + } + + /** + * Initializes a new instance of the MetricsClientImpl class. + * + * @param credentials Windows Azure subscription id + * @param baseUri Optional base uri parameter. + */ + public MetricsClientImpl(SubscriptionCloudCredentials credentials, URI baseUri) + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (baseUri == null) + { + throw new NullPointerException("baseUri"); + } + this.credentials = credentials; + this.baseUri = baseUri; + + httpClient = credentials.initializeClient(); + } + + /** + * Initializes a new instance of the MetricsClientImpl class. + * + * @param credentials Windows Azure subscription id + */ + @Inject + public MetricsClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CREDENTIALS) SubscriptionCloudCredentials credentials) throws java.net.URISyntaxException + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + this.credentials = credentials; + this.baseUri = new URI("https://management.core.windows.net"); + + httpClient = credentials.initializeClient(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsService.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsService.java new file mode 100644 index 000000000000..393d8d838740 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/MetricsService.java @@ -0,0 +1,70 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.monitoring.metrics; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access service management functionality. + * + */ +public class MetricsService { + + private MetricsService() { + // class is not instantiated + } + + /** + * Creates an instance of the MetricsClient API. + * + */ + public static MetricsClient create() { + return Configuration.getInstance().create(MetricsClient.class); + } + + /** + * Creates an instance of the MetricsClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static MetricsClient create(Configuration config) { + return config.create(MetricsClient.class); + } + + /** + * Creates an instance of the MetricsClient API. + * + * @param profile + * A String object that representing the profile of the service management service. + * + */ + public static MetricsClient create(String profile) { + return Configuration.getInstance().create(profile, MetricsClient.class); + } + + /** + * Creates an instance of the MetricsClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static MetricsClient create(String profile, Configuration config) { + return config.create(profile, MetricsClient.class); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/AvailabilityMetricSettingValue.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/AvailabilityMetricSettingValue.java new file mode 100644 index 000000000000..6e7b9dcabe28 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/AvailabilityMetricSettingValue.java @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; + +/** +* An availability metric setting response. +*/ +public class AvailabilityMetricSettingValue extends MetricSettingValue +{ + private ArrayList availabilityMetrics; + + /** + * The metric settings availability metrics. + */ + public ArrayList getAvailabilityMetrics() { return this.availabilityMetrics; } + + /** + * The metric settings availability metrics. + */ + public void setAvailabilityMetrics(ArrayList availabilityMetrics) { this.availabilityMetrics = availabilityMetrics; } + + private ArrayList availableLocations; + + /** + * The metric settings available locations. + */ + public ArrayList getAvailableLocations() { return this.availableLocations; } + + /** + * The metric settings available locations. + */ + public void setAvailableLocations(ArrayList availableLocations) { this.availableLocations = availableLocations; } + + private ArrayList defaultMetrics; + + /** + * The metric settings default metrics. + */ + public ArrayList getDefaultMetrics() { return this.defaultMetrics; } + + /** + * The metric settings default metrics. + */ + public void setDefaultMetrics(ArrayList defaultMetrics) { this.defaultMetrics = defaultMetrics; } + + private ArrayList endpoints; + + /** + * The metric settings endpoints. + */ + public ArrayList getEndpoints() { return this.endpoints; } + + /** + * The metric settings endpoints. + */ + public void setEndpoints(ArrayList endpoints) { this.endpoints = endpoints; } + + /** + * Initializes a new instance of the AvailabilityMetricSettingValue class. + * + */ + public AvailabilityMetricSettingValue() + { + this.availabilityMetrics = new ArrayList(); + this.availableLocations = new ArrayList(); + this.defaultMetrics = new ArrayList(); + this.endpoints = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/EndpointConfig.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/EndpointConfig.java new file mode 100644 index 000000000000..da7c8f5d4418 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/EndpointConfig.java @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.net.URI; + +/** +* An availability metric endpoint config. +*/ +public class EndpointConfig +{ + private String configId; + + /** + * Availability Metric endpoint config config id. + */ + public String getConfigId() { return this.configId; } + + /** + * Availability Metric endpoint config config id. + */ + public void setConfigId(String configId) { this.configId = configId; } + + private String location; + + /** + * Availability Metric endpoint config location. + */ + public String getLocation() { return this.location; } + + /** + * Availability Metric endpoint config location. + */ + public void setLocation(String location) { this.location = location; } + + private String name; + + /** + * Availability Metric endpoint config name. + */ + public String getName() { return this.name; } + + /** + * Availability Metric endpoint config name. + */ + public void setName(String name) { this.name = name; } + + private int testIntervalInSeconds; + + /** + * Availability Metric endpoint config test interval in seconds. + */ + public int getTestIntervalInSeconds() { return this.testIntervalInSeconds; } + + /** + * Availability Metric endpoint config test interval in seconds. + */ + public void setTestIntervalInSeconds(int testIntervalInSeconds) { this.testIntervalInSeconds = testIntervalInSeconds; } + + private URI url; + + /** + * Availability Metric endpoint config Url. + */ + public URI getUrl() { return this.url; } + + /** + * Availability Metric endpoint config Url. + */ + public void setUrl(URI url) { this.url = url; } + + /** + * Initializes a new instance of the EndpointConfig class. + * + */ + public EndpointConfig() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricAvailability.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricAvailability.java new file mode 100644 index 000000000000..6cf76912389b --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricAvailability.java @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import javax.xml.datatype.Duration; + +/** +* A metric availability. +*/ +public class MetricAvailability +{ + private Duration retention; + + /** + * Metric definition is alertable. + */ + public Duration getRetention() { return this.retention; } + + /** + * Metric definition is alertable. + */ + public void setRetention(Duration retention) { this.retention = retention; } + + private Duration timeGrain; + + /** + * Metric availability time grain. + */ + public Duration getTimeGrain() { return this.timeGrain; } + + /** + * Metric availability time grain. + */ + public void setTimeGrain(Duration timeGrain) { this.timeGrain = timeGrain; } + + /** + * Initializes a new instance of the MetricAvailability class. + * + */ + public MetricAvailability() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinition.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinition.java new file mode 100644 index 000000000000..ce45383dfc2b --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinition.java @@ -0,0 +1,148 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; +import javax.xml.datatype.Duration; + +/** +* A metric definition. +*/ +public class MetricDefinition +{ + private String displayName; + + /** + * Metric definition display name. + */ + public String getDisplayName() { return this.displayName; } + + /** + * Metric definition display name. + */ + public void setDisplayName(String displayName) { this.displayName = displayName; } + + private boolean isAlertable; + + /** + * Metric definition is alertable. + */ + public boolean getIsAlertable() { return this.isAlertable; } + + /** + * Metric definition is alertable. + */ + public void setIsAlertable(boolean isAlertable) { this.isAlertable = isAlertable; } + + private ArrayList metricAvailabilities; + + /** + * Metric definition metric availabilities. + */ + public ArrayList getMetricAvailabilities() { return this.metricAvailabilities; } + + /** + * Metric definition metric availabilities. + */ + public void setMetricAvailabilities(ArrayList metricAvailabilities) { this.metricAvailabilities = metricAvailabilities; } + + private Duration minimumAlertableTimeWindow; + + /** + * Metric definition minimum alertable time window. + */ + public Duration getMinimumAlertableTimeWindow() { return this.minimumAlertableTimeWindow; } + + /** + * Metric definition minimum alertable time window. + */ + public void setMinimumAlertableTimeWindow(Duration minimumAlertableTimeWindow) { this.minimumAlertableTimeWindow = minimumAlertableTimeWindow; } + + private String name; + + /** + * Metric definition name. + */ + public String getName() { return this.name; } + + /** + * Metric definition name. + */ + public void setName(String name) { this.name = name; } + + private String namespace; + + /** + * Metric definition namespace. + */ + public String getNamespace() { return this.namespace; } + + /** + * Metric definition namespace. + */ + public void setNamespace(String namespace) { this.namespace = namespace; } + + private String primaryAggregation; + + /** + * Metric definition primary aggregation. + */ + public String getPrimaryAggregation() { return this.primaryAggregation; } + + /** + * Metric definition primary aggregation. + */ + public void setPrimaryAggregation(String primaryAggregation) { this.primaryAggregation = primaryAggregation; } + + private String resourceIdSuffix; + + /** + * Metric definition resource id suffix. + */ + public String getResourceIdSuffix() { return this.resourceIdSuffix; } + + /** + * Metric definition resource id suffix. + */ + public void setResourceIdSuffix(String resourceIdSuffix) { this.resourceIdSuffix = resourceIdSuffix; } + + private String unit; + + /** + * Metric definition unit. + */ + public String getUnit() { return this.unit; } + + /** + * Metric definition unit. + */ + public void setUnit(String unit) { this.unit = unit; } + + /** + * Initializes a new instance of the MetricDefinition class. + * + */ + public MetricDefinition() + { + this.metricAvailabilities = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionCollection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionCollection.java new file mode 100644 index 000000000000..f5a82ad8659d --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionCollection.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; + +/** +* An availability metric name config. +*/ +public class MetricDefinitionCollection +{ + private ArrayList value; + + /** + * The metric definitions. + */ + public ArrayList getValue() { return this.value; } + + /** + * The metric definitions. + */ + public void setValue(ArrayList value) { this.value = value; } + + /** + * Initializes a new instance of the MetricDefinitionCollection class. + * + */ + public MetricDefinitionCollection() + { + this.value = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionListResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionListResponse.java new file mode 100644 index 000000000000..8088fa677833 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricDefinitionListResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The List Metric Definitions operation response. +*/ +public class MetricDefinitionListResponse extends OperationResponse +{ + private MetricDefinitionCollection metricDefinitionCollection; + + /** + * The retrieved metric definitions. + */ + public MetricDefinitionCollection getMetricDefinitionCollection() { return this.metricDefinitionCollection; } + + /** + * The retrieved metric definitions. + */ + public void setMetricDefinitionCollection(MetricDefinitionCollection metricDefinitionCollection) { this.metricDefinitionCollection = metricDefinitionCollection; } + + /** + * Initializes a new instance of the MetricDefinitionListResponse class. + * + */ + public MetricDefinitionListResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSetting.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSetting.java new file mode 100644 index 000000000000..64b682c332c4 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSetting.java @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +/** +* A metric setting get response. +*/ +public class MetricSetting +{ + private String namespace; + + /** + * Required. The metric settings namespace. + */ + public String getNamespace() { return this.namespace; } + + /** + * Required. The metric settings namespace. + */ + public void setNamespace(String namespace) { this.namespace = namespace; } + + private String resourceId; + + /** + * Required. The resource id. + */ + public String getResourceId() { return this.resourceId; } + + /** + * Required. The resource id. + */ + public void setResourceId(String resourceId) { this.resourceId = resourceId; } + + private MetricSettingValue value; + + /** + * Required. The metric settings value. + */ + public MetricSettingValue getValue() { return this.value; } + + /** + * Required. The metric settings value. + */ + public void setValue(MetricSettingValue value) { this.value = value; } + + /** + * Initializes a new instance of the MetricSetting class. + * + */ + public MetricSetting() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingCollection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingCollection.java new file mode 100644 index 000000000000..9b7753f67c2a --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingCollection.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; + +/** +* A metric setting list response collection. +*/ +public class MetricSettingCollection +{ + private ArrayList value; + + /** + * The collection. + */ + public ArrayList getValue() { return this.value; } + + /** + * The collection. + */ + public void setValue(ArrayList value) { this.value = value; } + + /** + * Initializes a new instance of the MetricSettingCollection class. + * + */ + public MetricSettingCollection() + { + this.value = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingListResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingListResponse.java new file mode 100644 index 000000000000..26bbf0aeef48 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingListResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The list metric settings operation response. +*/ +public class MetricSettingListResponse extends OperationResponse +{ + private MetricSettingCollection metricSettingCollection; + + /** + * The retrieved metric settings. + */ + public MetricSettingCollection getMetricSettingCollection() { return this.metricSettingCollection; } + + /** + * The retrieved metric settings. + */ + public void setMetricSettingCollection(MetricSettingCollection metricSettingCollection) { this.metricSettingCollection = metricSettingCollection; } + + /** + * Initializes a new instance of the MetricSettingListResponse class. + * + */ + public MetricSettingListResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingValue.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingValue.java new file mode 100644 index 000000000000..7549d2c821aa --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingValue.java @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +/** +* A metric setting get response. +*/ +public abstract class MetricSettingValue +{ + /** + * Initializes a new instance of the MetricSettingValue class. + * + */ + public MetricSettingValue() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingsPutParameters.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingsPutParameters.java new file mode 100644 index 000000000000..1b92f9ef4187 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricSettingsPutParameters.java @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +/** +* Parameters supplied to the Put Metric Settings operation. +*/ +public class MetricSettingsPutParameters +{ + private MetricSetting metricSetting; + + /** + * Required. The metric setting. + */ + public MetricSetting getMetricSetting() { return this.metricSetting; } + + /** + * Required. The metric setting. + */ + public void setMetricSetting(MetricSetting metricSetting) { this.metricSetting = metricSetting; } + + /** + * Initializes a new instance of the MetricSettingsPutParameters class. + * + */ + public MetricSettingsPutParameters() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValue.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValue.java new file mode 100644 index 000000000000..eab8c5bc7525 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValue.java @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.Calendar; + +/** +* A metric value. +*/ +public class MetricValue +{ + private String annotation; + + /** + * Metric annotation. + */ + public String getAnnotation() { return this.annotation; } + + /** + * Metric annotation. + */ + public void setAnnotation(String annotation) { this.annotation = annotation; } + + private Double average; + + /** + * Metric average. + */ + public Double getAverage() { return this.average; } + + /** + * Metric average. + */ + public void setAverage(Double average) { this.average = average; } + + private Integer count; + + /** + * Metric count. + */ + public Integer getCount() { return this.count; } + + /** + * Metric count. + */ + public void setCount(Integer count) { this.count = count; } + + private Double maximum; + + /** + * Metric maximum. + */ + public Double getMaximum() { return this.maximum; } + + /** + * Metric maximum. + */ + public void setMaximum(Double maximum) { this.maximum = maximum; } + + private Double minimum; + + /** + * Metric minimum. + */ + public Double getMinimum() { return this.minimum; } + + /** + * Metric minimum. + */ + public void setMinimum(Double minimum) { this.minimum = minimum; } + + private Calendar timestamp; + + /** + * Metric timestamp. + */ + public Calendar getTimestamp() { return this.timestamp; } + + /** + * Metric timestamp. + */ + public void setTimestamp(Calendar timestamp) { this.timestamp = timestamp; } + + private Double total; + + /** + * Metric total. + */ + public Double getTotal() { return this.total; } + + /** + * Metric total. + */ + public void setTotal(Double total) { this.total = total; } + + /** + * Initializes a new instance of the MetricValue class. + * + */ + public MetricValue() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueListResponse.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueListResponse.java new file mode 100644 index 000000000000..a6dbd3f60806 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueListResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The List Metric values operation response. +*/ +public class MetricValueListResponse extends OperationResponse +{ + private MetricValueSetCollection metricValueSetCollection; + + /** + * The retrieved metric value sets. + */ + public MetricValueSetCollection getMetricValueSetCollection() { return this.metricValueSetCollection; } + + /** + * The retrieved metric value sets. + */ + public void setMetricValueSetCollection(MetricValueSetCollection metricValueSetCollection) { this.metricValueSetCollection = metricValueSetCollection; } + + /** + * Initializes a new instance of the MetricValueListResponse class. + * + */ + public MetricValueListResponse() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSet.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSet.java new file mode 100644 index 000000000000..903ba282a19f --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSet.java @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; +import java.util.Calendar; +import javax.xml.datatype.Duration; + +/** +* A metric value set. +*/ +public class MetricValueSet +{ + private String displayName; + + /** + * Metric display name. + */ + public String getDisplayName() { return this.displayName; } + + /** + * Metric display name. + */ + public void setDisplayName(String displayName) { this.displayName = displayName; } + + private Calendar endTime; + + /** + * Metric end time. + */ + public Calendar getEndTime() { return this.endTime; } + + /** + * Metric end time. + */ + public void setEndTime(Calendar endTime) { this.endTime = endTime; } + + private ArrayList metricValues; + + /** + * Metric values. + */ + public ArrayList getMetricValues() { return this.metricValues; } + + /** + * Metric values. + */ + public void setMetricValues(ArrayList metricValues) { this.metricValues = metricValues; } + + private String name; + + /** + * Metric name. + */ + public String getName() { return this.name; } + + /** + * Metric name. + */ + public void setName(String name) { this.name = name; } + + private String namespace; + + /** + * Metric namespace. + */ + public String getNamespace() { return this.namespace; } + + /** + * Metric namespace. + */ + public void setNamespace(String namespace) { this.namespace = namespace; } + + private String primaryAggregation; + + /** + * Metric primary aggregation. + */ + public String getPrimaryAggregation() { return this.primaryAggregation; } + + /** + * Metric primary aggregation. + */ + public void setPrimaryAggregation(String primaryAggregation) { this.primaryAggregation = primaryAggregation; } + + private Calendar startTime; + + /** + * Metric start time. + */ + public Calendar getStartTime() { return this.startTime; } + + /** + * Metric start time. + */ + public void setStartTime(Calendar startTime) { this.startTime = startTime; } + + private Duration timeGrain; + + /** + * Metric time grain. + */ + public Duration getTimeGrain() { return this.timeGrain; } + + /** + * Metric time grain. + */ + public void setTimeGrain(Duration timeGrain) { this.timeGrain = timeGrain; } + + private String unit; + + /** + * Metric unit. + */ + public String getUnit() { return this.unit; } + + /** + * Metric unit. + */ + public void setUnit(String unit) { this.unit = unit; } + + /** + * Initializes a new instance of the MetricValueSet class. + * + */ + public MetricValueSet() + { + this.metricValues = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSetCollection.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSetCollection.java new file mode 100644 index 000000000000..220615cd321d --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/MetricValueSetCollection.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +import java.util.ArrayList; + +/** +* The collection of metric value sets. +*/ +public class MetricValueSetCollection +{ + private ArrayList value; + + /** + * The collection. + */ + public ArrayList getValue() { return this.value; } + + /** + * The collection. + */ + public void setValue(ArrayList value) { this.value = value; } + + /** + * Initializes a new instance of the MetricValueSetCollection class. + * + */ + public MetricValueSetCollection() + { + this.value = new ArrayList(); + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/NameConfig.java b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/NameConfig.java new file mode 100644 index 000000000000..a223028ead2e --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/models/NameConfig.java @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.monitoring.metrics.models; + +/** +* An availability metric name config. +*/ +public class NameConfig +{ + private String displayName; + + /** + * Availability metric name config display name. + */ + public String getDisplayName() { return this.displayName; } + + /** + * Availability metric name config display name. + */ + public void setDisplayName(String displayName) { this.displayName = displayName; } + + private String name; + + /** + * Availability metric name config name. + */ + public String getName() { return this.name; } + + /** + * Availability metric name config name. + */ + public void setName(String name) { this.name = name; } + + /** + * Initializes a new instance of the NameConfig class. + * + */ + public NameConfig() + { + } +} diff --git a/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/package.html b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/package.html new file mode 100644 index 000000000000..e8dfd96862b7 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/java/com/microsoft/windowsazure/management/monitoring/metrics/package.html @@ -0,0 +1,6 @@ + + +This package contains the service management class, + interface, and associated configuration and utility classes. + + diff --git a/microsoft-azure-api-management-monitoring/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-monitoring/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports new file mode 100644 index 000000000000..4160b6949724 --- /dev/null +++ b/microsoft-azure-api-management-monitoring/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -0,0 +1 @@ +com.microsoft.windowsazure.management.virtualnetworks.Exports diff --git a/microsoft-azure-api-management-scheduler/pom.xml b/microsoft-azure-api-management-scheduler/pom.xml new file mode 100644 index 000000000000..a7abe1a3ed1e --- /dev/null +++ b/microsoft-azure-api-management-scheduler/pom.xml @@ -0,0 +1,260 @@ + + + 4.0.0 + + com.microsoft.windowsazure + microsoft-azure-api-parent + 0.4.6 + ../microsoft-azure-api-parent/pom.xml + + + microsoft-azure-api-management-scheduler + jar + + Microsoft Windows Azure Scheduler Management Client API + Windows Azure Scheduler Management SDK Clients + https://github.com/WindowsAzure/azure-sdk-for-java + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + scm:git:https://github.com/WindowsAzure/azure-sdk-for-java + scm:git:git://github.com/WindowsAzure/azure-sdk-for-java.git + + + + UTF-8 + + + 2.1.1 + 3.0.7.RELEASE + + + + + microsoft + Microsoft + + + + + + ${project.groupId} + microsoft-azure-api-core + 0.4.6 + + + commons-logging + commons-logging + + + commons-codec + commons-codec + 1.2 + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + + com.sun.jersey + jersey-client + + + javax.xml.bind + jaxb-api + provided + + + junit + junit + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-all + test + + + javax.inject + javax.inject + + + com.sun.jersey + jersey-json + + + javax.mail + mail + + + org.bouncycastle + bcprov-jdk16 + test + + + + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + validate + + evaluate + + + legal + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.8.3 + + + serviceBus + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/serviceBus + + servicebus-atom.xsd + + com.microsoft.windowsazure.services.serviceBus.implementation + false + true + + + + management + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/management/ + + schemas.microsoft.com.windowsazure.xsd + + com.microsoft.windowsazure.services.management.implementation + false + true + + + + + true + true + true + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.6.4 + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.4 + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright Microsoft Corporation +
* +
* 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. +
*/]]>
+
+
+ + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + true + true + true + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.8 + + src/config/checkstyle.xml + + + +
+
+
diff --git a/microsoft-azure-api-management-scheduler/src/config/checkstyle.xml b/microsoft-azure-api-management-scheduler/src/config/checkstyle.xml new file mode 100644 index 000000000000..58a40f4ac43a --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/config/checkstyle.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/Exports.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/Exports.java new file mode 100644 index 000000000000..cf730ea29f51 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/Exports.java @@ -0,0 +1,33 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.services.core.Builder; + +/** + * The Class Exports. + */ +public class Exports implements Builder.Exports { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.Builder.Exports#register(com.microsoft.windowsazure.services.core.Builder.Registry) + */ + @Override + public void register(Builder.Registry registry) { + + // provide contract implementation + registry.add(SchedulerManagementClient.class, SchedulerManagementClientImpl.class); + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperations.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperations.java new file mode 100644 index 000000000000..45a6ef4fa8db --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperations.java @@ -0,0 +1,267 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCheckNameAvailabilityResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCreateParameters; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCreateResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionGetResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionUpdateParameters; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionUpdateResponse; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatusResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import org.xml.sax.SAXException; + +public interface JobCollectionOperations +{ + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The Create Job Collection operation response. + */ + JobCollectionCreateResponse beginCreating(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters) throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException, IOException, ServiceException; + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The Create Job Collection operation response. + */ + Future beginCreatingAsync(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters); + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse beginDeleting(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException; + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future beginDeletingAsync(String cloudServiceName, String jobCollectionName); + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The Update Job Collection operation response. + */ + JobCollectionUpdateResponse beginUpdating(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters) throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException, IOException, ServiceException; + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The Update Job Collection operation response. + */ + Future beginUpdatingAsync(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters); + + /** + * Determine if the JobCollection name is available to be used. + * JobCollection names must be unique within a cloud-service. + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName A name for the JobCollection. The name must be + * unique as scoped within the CloudService. The name can be up to 100 + * characters in length. + * @return The Check Name Availability operation response. + */ + JobCollectionCheckNameAvailabilityResponse checkNameAvailability(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException, ParserConfigurationException, SAXException; + + /** + * Determine if the JobCollection name is available to be used. + * JobCollection names must be unique within a cloud-service. + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName A name for the JobCollection. The name must be + * unique as scoped within the CloudService. The name can be up to 100 + * characters in length. + * @return The Check Name Availability operation response. + */ + Future checkNameAvailabilityAsync(String cloudServiceName, String jobCollectionName); + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + SchedulerOperationStatusResponse create(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters) throws InterruptedException, ExecutionException, ServiceException; + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + Future createAsync(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters); + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + SchedulerOperationStatusResponse delete(String cloudServiceName, String jobCollectionName) throws InterruptedException, ExecutionException, ServiceException; + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + Future deleteAsync(String cloudServiceName, String jobCollectionName); + + /** + * Retreive a job collection. + * + * @param cloudServiceName Name of the cloud service. + * @param jobCollectionName Name of the job collection. + * @return The Get Job Collection operation response. + */ + JobCollectionGetResponse get(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException, ParserConfigurationException, SAXException; + + /** + * Retreive a job collection. + * + * @param cloudServiceName Name of the cloud service. + * @param jobCollectionName Name of the job collection. + * @return The Get Job Collection operation response. + */ + Future getAsync(String cloudServiceName, String jobCollectionName); + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + SchedulerOperationStatusResponse update(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters) throws InterruptedException, ExecutionException, ServiceException; + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + Future updateAsync(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters); +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperationsImpl.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperationsImpl.java new file mode 100644 index 000000000000..1677eb41c90a --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/JobCollectionOperationsImpl.java @@ -0,0 +1,1099 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCheckNameAvailabilityResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCreateParameters; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionCreateResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionGetResponse; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionIntrinsicSettings; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionMaxRecurrence; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionPlan; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionQuota; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionRecurrenceFrequency; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionState; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionUpdateParameters; +import com.microsoft.windowsazure.management.scheduler.models.JobCollectionUpdateResponse; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatus; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatusResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.apache.commons.codec.binary.Base64; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.StringEntity; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +public class JobCollectionOperationsImpl implements ServiceOperations, JobCollectionOperations +{ + /** + * Initializes a new instance of the JobCollectionOperationsImpl class. + * + * @param client Reference to the service client. + */ + JobCollectionOperationsImpl(SchedulerManagementClientImpl client) + { + this.client = client; + } + + private SchedulerManagementClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.management.scheduler.SchedulerManagementClientImpl. + */ + public SchedulerManagementClientImpl getClient() { return this.client; } + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The Create Job Collection operation response. + */ + @Override + public Future beginCreatingAsync(final String cloudServiceName, final String jobCollectionName, final JobCollectionCreateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCollectionCreateResponse call() throws Exception + { + return beginCreating(cloudServiceName, jobCollectionName, parameters); + } + }); + } + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The Create Job Collection operation response. + */ + @Override + public JobCollectionCreateResponse beginCreating(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters) throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException, IOException, ServiceException + { + // Validate + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + if (jobCollectionName.length() > 100) + { + throw new IllegalArgumentException("jobCollectionName"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + cloudServiceName + "/resources/" + "scheduler" + "/" + "JobCollections" + "/" + jobCollectionName; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/xml"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document requestDoc = documentBuilder.newDocument(); + + Element resourceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Resource"); + requestDoc.appendChild(resourceElement); + + if (parameters.getSchemaVersion() != null) + { + Element schemaVersionElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "SchemaVersion"); + schemaVersionElement.appendChild(requestDoc.createTextNode(parameters.getSchemaVersion())); + resourceElement.appendChild(schemaVersionElement); + } + + if (parameters.getLabel() != null) + { + Element labelElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Label"); + labelElement.appendChild(requestDoc.createTextNode(new String(Base64.encodeBase64(parameters.getLabel().getBytes())))); + resourceElement.appendChild(labelElement); + } + + if (parameters.getIntrinsicSettings() != null) + { + Element intrinsicSettingsElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "IntrinsicSettings"); + resourceElement.appendChild(intrinsicSettingsElement); + + Element planElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Plan"); + planElement.appendChild(requestDoc.createTextNode(parameters.getIntrinsicSettings().getPlan().toString())); + intrinsicSettingsElement.appendChild(planElement); + + if (parameters.getIntrinsicSettings().getQuota() != null) + { + Element quotaElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Quota"); + intrinsicSettingsElement.appendChild(quotaElement); + + if (parameters.getIntrinsicSettings().getQuota().getMaxJobCount() != null) + { + Element maxJobCountElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxJobCount"); + maxJobCountElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxJobCount()))); + quotaElement.appendChild(maxJobCountElement); + } + + if (parameters.getIntrinsicSettings().getQuota().getMaxJobOccurrence() != null) + { + Element maxJobOccurrenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxJobOccurrence"); + maxJobOccurrenceElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxJobOccurrence()))); + quotaElement.appendChild(maxJobOccurrenceElement); + } + + if (parameters.getIntrinsicSettings().getQuota().getMaxRecurrence() != null) + { + Element maxRecurrenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxRecurrence"); + quotaElement.appendChild(maxRecurrenceElement); + + Element frequencyElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Frequency"); + frequencyElement.appendChild(requestDoc.createTextNode(parameters.getIntrinsicSettings().getQuota().getMaxRecurrence().getFrequency().toString())); + maxRecurrenceElement.appendChild(frequencyElement); + + Element intervalElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Interval"); + intervalElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxRecurrence().getInterval()))); + maxRecurrenceElement.appendChild(intervalElement); + } + } + } + + DOMSource domSource = new DOMSource(requestDoc); + StringWriter stringWriter = new StringWriter(); + StreamResult streamResult = new StreamResult(stringWriter); + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + transformer.transform(domSource, streamResult); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/xml"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 202) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCollectionCreateResponse result = null; + result = new JobCollectionCreateResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("ETag").length > 0) + { + result.setETag(httpResponse.getFirstHeader("ETag").getValue()); + } + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future beginDeletingAsync(final String cloudServiceName, final String jobCollectionName) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return beginDeleting(cloudServiceName, jobCollectionName); + } + }); + } + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse beginDeleting(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException + { + // Validate + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + cloudServiceName + "/resources/" + "scheduler" + "/" + "JobCollections" + "/" + jobCollectionName; + + // Create HTTP transport objects + CustomHttpDelete httpRequest = new CustomHttpDelete(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 202) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The Update Job Collection operation response. + */ + @Override + public Future beginUpdatingAsync(final String cloudServiceName, final String jobCollectionName, final JobCollectionUpdateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCollectionUpdateResponse call() throws Exception + { + return beginUpdating(cloudServiceName, jobCollectionName, parameters); + } + }); + } + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The Update Job Collection operation response. + */ + @Override + public JobCollectionUpdateResponse beginUpdating(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters) throws ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException, IOException, ServiceException + { + // Validate + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + if (jobCollectionName.length() > 100) + { + throw new IllegalArgumentException("jobCollectionName"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + if (parameters.getETag() == null) + { + throw new NullPointerException("parameters.ETag"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + cloudServiceName + "/resources/" + "scheduler" + "/" + "JobCollections" + "/" + jobCollectionName; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/xml"); + httpRequest.setHeader("If-Match", parameters.getETag()); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document requestDoc = documentBuilder.newDocument(); + + Element resourceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Resource"); + requestDoc.appendChild(resourceElement); + + if (parameters.getSchemaVersion() != null) + { + Element schemaVersionElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "SchemaVersion"); + schemaVersionElement.appendChild(requestDoc.createTextNode(parameters.getSchemaVersion())); + resourceElement.appendChild(schemaVersionElement); + } + + if (parameters.getLabel() != null) + { + Element labelElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Label"); + labelElement.appendChild(requestDoc.createTextNode(new String(Base64.encodeBase64(parameters.getLabel().getBytes())))); + resourceElement.appendChild(labelElement); + } + + if (parameters.getIntrinsicSettings() != null) + { + Element intrinsicSettingsElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "IntrinsicSettings"); + resourceElement.appendChild(intrinsicSettingsElement); + + Element planElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Plan"); + planElement.appendChild(requestDoc.createTextNode(parameters.getIntrinsicSettings().getPlan().toString())); + intrinsicSettingsElement.appendChild(planElement); + + if (parameters.getIntrinsicSettings().getQuota() != null) + { + Element quotaElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Quota"); + intrinsicSettingsElement.appendChild(quotaElement); + + if (parameters.getIntrinsicSettings().getQuota().getMaxJobCount() != null) + { + Element maxJobCountElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxJobCount"); + maxJobCountElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxJobCount()))); + quotaElement.appendChild(maxJobCountElement); + } + + if (parameters.getIntrinsicSettings().getQuota().getMaxJobOccurrence() != null) + { + Element maxJobOccurrenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxJobOccurrence"); + maxJobOccurrenceElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxJobOccurrence()))); + quotaElement.appendChild(maxJobOccurrenceElement); + } + + if (parameters.getIntrinsicSettings().getQuota().getMaxRecurrence() != null) + { + Element maxRecurrenceElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "MaxRecurrence"); + quotaElement.appendChild(maxRecurrenceElement); + + Element frequencyElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Frequency"); + frequencyElement.appendChild(requestDoc.createTextNode(parameters.getIntrinsicSettings().getQuota().getMaxRecurrence().getFrequency().toString())); + maxRecurrenceElement.appendChild(frequencyElement); + + Element intervalElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Interval"); + intervalElement.appendChild(requestDoc.createTextNode(Integer.toString(parameters.getIntrinsicSettings().getQuota().getMaxRecurrence().getInterval()))); + maxRecurrenceElement.appendChild(intervalElement); + } + } + } + + DOMSource domSource = new DOMSource(requestDoc); + StringWriter stringWriter = new StringWriter(); + StreamResult streamResult = new StreamResult(stringWriter); + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + transformer.transform(domSource, streamResult); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/xml"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 202) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCollectionUpdateResponse result = null; + result = new JobCollectionUpdateResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("ETag").length > 0) + { + result.setETag(httpResponse.getFirstHeader("ETag").getValue()); + } + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Determine if the JobCollection name is available to be used. + * JobCollection names must be unique within a cloud-service. + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName A name for the JobCollection. The name must be + * unique as scoped within the CloudService. The name can be up to 100 + * characters in length. + * @return The Check Name Availability operation response. + */ + @Override + public Future checkNameAvailabilityAsync(final String cloudServiceName, final String jobCollectionName) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCollectionCheckNameAvailabilityResponse call() throws Exception + { + return checkNameAvailability(cloudServiceName, jobCollectionName); + } + }); + } + + /** + * Determine if the JobCollection name is available to be used. + * JobCollection names must be unique within a cloud-service. + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName A name for the JobCollection. The name must be + * unique as scoped within the CloudService. The name can be up to 100 + * characters in length. + * @return The Check Name Availability operation response. + */ + @Override + public JobCollectionCheckNameAvailabilityResponse checkNameAvailability(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException, ParserConfigurationException, SAXException + { + // Validate + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + if (jobCollectionName.length() > 100) + { + throw new IllegalArgumentException("jobCollectionName"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + cloudServiceName + "/resources/" + "scheduler" + "/" + "JobCollections" + "/?op=checknameavailability&resourceName=" + jobCollectionName; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCollectionCheckNameAvailabilityResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobCollectionCheckNameAvailabilityResponse(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document responseDoc = documentBuilder.parse(responseContent); + + NodeList elements = responseDoc.getElementsByTagName("ResourceNameAvailabilityResponse"); + Element resourceNameAvailabilityResponseElement = elements.getLength() > 0 ? ((Element)elements.item(0)) : null; + if (resourceNameAvailabilityResponseElement != null) + { + NodeList elements2 = resourceNameAvailabilityResponseElement.getElementsByTagName("IsAvailable"); + Element isAvailableElement = elements2.getLength() > 0 ? ((Element)elements2.item(0)) : null; + if (isAvailableElement != null) + { + boolean isAvailableInstance; + isAvailableInstance = Boolean.parseBoolean(isAvailableElement.getTextContent()); + result.setIsAvailable(isAvailableInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public Future createAsync(final String cloudServiceName, final String jobCollectionName, final JobCollectionCreateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public SchedulerOperationStatusResponse call() throws Exception + { + return create(cloudServiceName, jobCollectionName, parameters); + } + }); + } + + /** + * Create a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to create. + * @param parameters Parameters supplied to the Create Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public SchedulerOperationStatusResponse create(String cloudServiceName, String jobCollectionName, JobCollectionCreateParameters parameters) throws InterruptedException, ExecutionException, ServiceException + { + SchedulerManagementClient client2 = this.getClient(); + + JobCollectionCreateResponse response = client2.getJobCollections().beginCreatingAsync(cloudServiceName, jobCollectionName, parameters).get(); + SchedulerOperationStatusResponse result = client2.getOperationStatusAsync(response.getRequestId()).get(); + int delayInSeconds = 15; + while ((result.getStatus() != SchedulerOperationStatus.InProgress) == false) + { + Thread.sleep(delayInSeconds * 1000); + result = client2.getOperationStatusAsync(response.getRequestId()).get(); + delayInSeconds = 10; + } + + if (result.getStatus() != SchedulerOperationStatus.Succeeded) + { + ServiceException ex = new ServiceException(result.getError().getCode() + " : " + result.getError().getMessage()); + ex.setErrorCode(result.getError().getCode()); + ex.setErrorMessage(result.getError().getMessage()); + throw ex; + } + + result.setETag(response.getETag()); + return result; + } + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public Future deleteAsync(final String cloudServiceName, final String jobCollectionName) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public SchedulerOperationStatusResponse call() throws Exception + { + return delete(cloudServiceName, jobCollectionName); + } + }); + } + + /** + * Deletes a job collection + * + * @param cloudServiceName The name of the cloud service. + * @param jobCollectionName The name of the job collection to delete. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public SchedulerOperationStatusResponse delete(String cloudServiceName, String jobCollectionName) throws InterruptedException, ExecutionException, ServiceException + { + SchedulerManagementClient client2 = this.getClient(); + + OperationResponse response = client2.getJobCollections().beginDeletingAsync(cloudServiceName, jobCollectionName).get(); + SchedulerOperationStatusResponse result = client2.getOperationStatusAsync(response.getRequestId()).get(); + int delayInSeconds = 15; + while ((result.getStatus() != SchedulerOperationStatus.InProgress) == false) + { + Thread.sleep(delayInSeconds * 1000); + result = client2.getOperationStatusAsync(response.getRequestId()).get(); + delayInSeconds = 10; + } + + if (result.getStatus() != SchedulerOperationStatus.Succeeded) + { + ServiceException ex = new ServiceException(result.getError().getCode() + " : " + result.getError().getMessage()); + ex.setErrorCode(result.getError().getCode()); + ex.setErrorMessage(result.getError().getMessage()); + throw ex; + } + + return result; + } + + /** + * Retreive a job collection. + * + * @param cloudServiceName Name of the cloud service. + * @param jobCollectionName Name of the job collection. + * @return The Get Job Collection operation response. + */ + @Override + public Future getAsync(final String cloudServiceName, final String jobCollectionName) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCollectionGetResponse call() throws Exception + { + return get(cloudServiceName, jobCollectionName); + } + }); + } + + /** + * Retreive a job collection. + * + * @param cloudServiceName Name of the cloud service. + * @param jobCollectionName Name of the job collection. + * @return The Get Job Collection operation response. + */ + @Override + public JobCollectionGetResponse get(String cloudServiceName, String jobCollectionName) throws IOException, ServiceException, ParserConfigurationException, SAXException + { + // Validate + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + cloudServiceName + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + jobCollectionName; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCollectionGetResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobCollectionGetResponse(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document responseDoc = documentBuilder.parse(responseContent); + + NodeList elements = responseDoc.getElementsByTagName("Resource"); + Element resourceElement = elements.getLength() > 0 ? ((Element)elements.item(0)) : null; + if (resourceElement != null) + { + NodeList elements2 = resourceElement.getElementsByTagName("Name"); + Element nameElement = elements2.getLength() > 0 ? ((Element)elements2.item(0)) : null; + if (nameElement != null) + { + String nameInstance; + nameInstance = nameElement.getTextContent(); + result.setName(nameInstance); + } + + NodeList elements3 = resourceElement.getElementsByTagName("ETag"); + Element eTagElement = elements3.getLength() > 0 ? ((Element)elements3.item(0)) : null; + if (eTagElement != null) + { + String eTagInstance; + eTagInstance = eTagElement.getTextContent(); + result.setETag(eTagInstance); + } + + NodeList elements4 = resourceElement.getElementsByTagName("State"); + Element stateElement = elements4.getLength() > 0 ? ((Element)elements4.item(0)) : null; + if (stateElement != null) + { + JobCollectionState stateInstance; + stateInstance = JobCollectionState.valueOf(stateElement.getTextContent()); + result.setState(stateInstance); + } + + NodeList elements5 = resourceElement.getElementsByTagName("SchemaVersion"); + Element schemaVersionElement = elements5.getLength() > 0 ? ((Element)elements5.item(0)) : null; + if (schemaVersionElement != null) + { + String schemaVersionInstance; + schemaVersionInstance = schemaVersionElement.getTextContent(); + result.setSchemaVersion(schemaVersionInstance); + } + + NodeList elements6 = resourceElement.getElementsByTagName("Plan"); + Element planElement = elements6.getLength() > 0 ? ((Element)elements6.item(0)) : null; + if (planElement != null) + { + String planInstance; + planInstance = planElement.getTextContent(); + result.setPlan(planInstance); + } + + NodeList elements7 = resourceElement.getElementsByTagName("PromotionCode"); + Element promotionCodeElement = elements7.getLength() > 0 ? ((Element)elements7.item(0)) : null; + if (promotionCodeElement != null) + { + String promotionCodeInstance; + promotionCodeInstance = promotionCodeElement.getTextContent(); + result.setPromotionCode(promotionCodeInstance); + } + + NodeList elements8 = resourceElement.getElementsByTagName("IntrinsicSettings"); + Element intrinsicSettingsElement = elements8.getLength() > 0 ? ((Element)elements8.item(0)) : null; + if (intrinsicSettingsElement != null) + { + JobCollectionIntrinsicSettings intrinsicSettingsInstance = new JobCollectionIntrinsicSettings(); + result.setIntrinsicSettings(intrinsicSettingsInstance); + + NodeList elements9 = intrinsicSettingsElement.getElementsByTagName("Plan"); + Element planElement2 = elements9.getLength() > 0 ? ((Element)elements9.item(0)) : null; + if (planElement2 != null) + { + JobCollectionPlan planInstance2; + planInstance2 = JobCollectionPlan.valueOf(planElement2.getTextContent()); + intrinsicSettingsInstance.setPlan(planInstance2); + } + + NodeList elements10 = intrinsicSettingsElement.getElementsByTagName("Quota"); + Element quotaElement = elements10.getLength() > 0 ? ((Element)elements10.item(0)) : null; + if (quotaElement != null) + { + JobCollectionQuota quotaInstance = new JobCollectionQuota(); + intrinsicSettingsInstance.setQuota(quotaInstance); + + NodeList elements11 = quotaElement.getElementsByTagName("MaxJobCount"); + Element maxJobCountElement = elements11.getLength() > 0 ? ((Element)elements11.item(0)) : null; + if (maxJobCountElement != null && (maxJobCountElement.getTextContent() != null && maxJobCountElement.getTextContent().isEmpty() != true) == false) + { + int maxJobCountInstance; + maxJobCountInstance = Integer.parseInt(maxJobCountElement.getTextContent()); + quotaInstance.setMaxJobCount(maxJobCountInstance); + } + + NodeList elements12 = quotaElement.getElementsByTagName("MaxJobOccurrence"); + Element maxJobOccurrenceElement = elements12.getLength() > 0 ? ((Element)elements12.item(0)) : null; + if (maxJobOccurrenceElement != null && (maxJobOccurrenceElement.getTextContent() != null && maxJobOccurrenceElement.getTextContent().isEmpty() != true) == false) + { + int maxJobOccurrenceInstance; + maxJobOccurrenceInstance = Integer.parseInt(maxJobOccurrenceElement.getTextContent()); + quotaInstance.setMaxJobOccurrence(maxJobOccurrenceInstance); + } + + NodeList elements13 = quotaElement.getElementsByTagName("MaxRecurrence"); + Element maxRecurrenceElement = elements13.getLength() > 0 ? ((Element)elements13.item(0)) : null; + if (maxRecurrenceElement != null) + { + JobCollectionMaxRecurrence maxRecurrenceInstance = new JobCollectionMaxRecurrence(); + quotaInstance.setMaxRecurrence(maxRecurrenceInstance); + + NodeList elements14 = maxRecurrenceElement.getElementsByTagName("Frequency"); + Element frequencyElement = elements14.getLength() > 0 ? ((Element)elements14.item(0)) : null; + if (frequencyElement != null) + { + JobCollectionRecurrenceFrequency frequencyInstance; + frequencyInstance = JobCollectionRecurrenceFrequency.valueOf(frequencyElement.getTextContent()); + maxRecurrenceInstance.setFrequency(frequencyInstance); + } + + NodeList elements15 = maxRecurrenceElement.getElementsByTagName("Interval"); + Element intervalElement = elements15.getLength() > 0 ? ((Element)elements15.item(0)) : null; + if (intervalElement != null) + { + int intervalInstance; + intervalInstance = Integer.parseInt(intervalElement.getTextContent()); + maxRecurrenceInstance.setInterval(intervalInstance); + } + } + } + } + + NodeList elements16 = resourceElement.getElementsByTagName("Label"); + Element labelElement = elements16.getLength() > 0 ? ((Element)elements16.item(0)) : null; + if (labelElement != null) + { + String labelInstance; + labelInstance = labelElement.getTextContent() != null ? new String(Base64.decodeBase64(labelElement.getTextContent().getBytes())) : null; + result.setLabel(labelInstance); + } + + NodeList elements17 = resourceElement.getElementsByTagName("CloudServiceSettings"); + Element cloudServiceSettingsElement = elements17.getLength() > 0 ? ((Element)elements17.item(0)) : null; + if (cloudServiceSettingsElement != null) + { + JobCollectionGetResponse.CloudServiceSettingInfo cloudServiceSettingsInstance = new JobCollectionGetResponse.CloudServiceSettingInfo(); + result.setCloudServiceSettings(cloudServiceSettingsInstance); + + NodeList elements18 = cloudServiceSettingsElement.getElementsByTagName("GeoRegion"); + Element geoRegionElement = elements18.getLength() > 0 ? ((Element)elements18.item(0)) : null; + if (geoRegionElement != null) + { + String geoRegionInstance; + geoRegionInstance = geoRegionElement.getTextContent(); + cloudServiceSettingsInstance.setGeoRegion(geoRegionInstance); + } + } + + NodeList elements19 = resourceElement.getElementsByTagName("OperationStatus"); + Element operationStatusElement = elements19.getLength() > 0 ? ((Element)elements19.item(0)) : null; + if (operationStatusElement != null) + { + JobCollectionGetResponse.OperationStatus operationStatusInstance = new JobCollectionGetResponse.OperationStatus(); + result.setLastOperationStatus(operationStatusInstance); + + NodeList elements20 = operationStatusElement.getElementsByTagName("Error"); + Element errorElement = elements20.getLength() > 0 ? ((Element)elements20.item(0)) : null; + if (errorElement != null) + { + JobCollectionGetResponse.OperationStatusResponseDetails errorInstance = new JobCollectionGetResponse.OperationStatusResponseDetails(); + operationStatusInstance.setResponseDetails(errorInstance); + + NodeList elements21 = errorElement.getElementsByTagName("HttpCode"); + Element httpCodeElement = elements21.getLength() > 0 ? ((Element)elements21.item(0)) : null; + if (httpCodeElement != null) + { + Integer httpCodeInstance; + httpCodeInstance = Integer.valueOf(httpCodeElement.getTextContent()); + errorInstance.setStatusCode(httpCodeInstance); + } + + NodeList elements22 = errorElement.getElementsByTagName("Message"); + Element messageElement = elements22.getLength() > 0 ? ((Element)elements22.item(0)) : null; + if (messageElement != null) + { + String messageInstance; + messageInstance = messageElement.getTextContent(); + errorInstance.setMessage(messageInstance); + } + } + + NodeList elements23 = operationStatusElement.getElementsByTagName("Result"); + Element resultElement = elements23.getLength() > 0 ? ((Element)elements23.item(0)) : null; + if (resultElement != null) + { + SchedulerOperationStatus resultInstance; + resultInstance = SchedulerOperationStatus.valueOf(resultElement.getTextContent()); + operationStatusInstance.setStatus(resultInstance); + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public Future updateAsync(final String cloudServiceName, final String jobCollectionName, final JobCollectionUpdateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public SchedulerOperationStatusResponse call() throws Exception + { + return update(cloudServiceName, jobCollectionName, parameters); + } + }); + } + + /** + * Update a job collection. + * + * @param cloudServiceName The name of the cloud service containing the job + * collection. + * @param jobCollectionName The name of the job collection to update. + * @param parameters Parameters supplied to the Update Job Collection + * operation. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public SchedulerOperationStatusResponse update(String cloudServiceName, String jobCollectionName, JobCollectionUpdateParameters parameters) throws InterruptedException, ExecutionException, ServiceException + { + SchedulerManagementClient client2 = this.getClient(); + + JobCollectionUpdateResponse response = client2.getJobCollections().beginUpdatingAsync(cloudServiceName, jobCollectionName, parameters).get(); + SchedulerOperationStatusResponse result = client2.getOperationStatusAsync(response.getRequestId()).get(); + int delayInSeconds = 15; + while ((result.getStatus() != SchedulerOperationStatus.InProgress) == false) + { + Thread.sleep(delayInSeconds * 1000); + result = client2.getOperationStatusAsync(response.getRequestId()).get(); + delayInSeconds = 10; + } + + if (result.getStatus() != SchedulerOperationStatus.Succeeded) + { + ServiceException ex = new ServiceException(result.getError().getCode() + " : " + result.getError().getMessage()); + ex.setErrorCode(result.getError().getCode()); + ex.setErrorMessage(result.getError().getMessage()); + throw ex; + } + + result.setETag(response.getETag()); + return result; + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClient.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClient.java new file mode 100644 index 000000000000..7011157e5e34 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClient.java @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.management.scheduler.models.ResourceProviderGetPropertiesResponse; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatusResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.net.URI; +import java.util.concurrent.Future; +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.SAXException; + +public interface SchedulerManagementClient +{ + URI getBaseUri(); + + SubscriptionCloudCredentials getCredentials(); + + JobCollectionOperations getJobCollections(); + + /** + * The Get Operation Status operation returns the status of thespecified + * operation. After calling an asynchronous operation, you can call Get + * Operation Status to determine whether the operation has succeeded, + * failed, or is still in progress. (see + * http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx for + * more information) + * + * @param requestId The request ID for the request you wish to track. The + * request ID is returned in the x-ms-request-id response header for every + * request. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + SchedulerOperationStatusResponse getOperationStatus(String requestId) throws IOException, ServiceException, ParserConfigurationException, SAXException; + + /** + * The Get Operation Status operation returns the status of thespecified + * operation. After calling an asynchronous operation, you can call Get + * Operation Status to determine whether the operation has succeeded, + * failed, or is still in progress. (see + * http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx for + * more information) + * + * @param requestId The request ID for the request you wish to track. The + * request ID is returned in the x-ms-request-id response header for every + * request. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + Future getOperationStatusAsync(String requestId); + + /** + * Gets a list of properties for the resource provider, including supported + * regions and plans. + * + * @return The Resource Provider Get Properties operation response. + */ + ResourceProviderGetPropertiesResponse getResourceProviderProperties() throws IOException, ServiceException, ParserConfigurationException, SAXException; + + /** + * Gets a list of properties for the resource provider, including supported + * regions and plans. + * + * @return The Resource Provider Get Properties operation response. + */ + Future getResourceProviderPropertiesAsync(); + + /** + * Register the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse registerResourceProvider() throws IOException, ServiceException; + + /** + * Register the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future registerResourceProviderAsync(); + + /** + * Unregister the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse unregisterResourceProvider() throws IOException, ServiceException; + + /** + * Unregister the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future unregisterResourceProviderAsync(); +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClientImpl.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClientImpl.java new file mode 100644 index 000000000000..139097d91d48 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementClientImpl.java @@ -0,0 +1,479 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.management.ManagementConfiguration; +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.management.scheduler.models.ResourceProviderGetPropertiesResponse; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatus; +import com.microsoft.windowsazure.management.scheduler.models.SchedulerOperationStatusResponse; +import com.microsoft.windowsazure.services.core.ServiceClient; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.inject.Inject; +import javax.inject.Named; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +public class SchedulerManagementClientImpl extends ServiceClient implements SchedulerManagementClient +{ + private URI baseUri; + + public URI getBaseUri() { return this.baseUri; } + + private SubscriptionCloudCredentials credentials; + + public SubscriptionCloudCredentials getCredentials() { return this.credentials; } + + private JobCollectionOperations jobCollections; + + public JobCollectionOperations getJobCollections() { return this.jobCollections; } + + /** + * Initializes a new instance of the SchedulerManagementClientImpl class. + * + */ + private SchedulerManagementClientImpl() + { + super(); + this.jobCollections = new JobCollectionOperationsImpl(this); + } + + /** + * Initializes a new instance of the SchedulerManagementClientImpl class. + * + */ + public SchedulerManagementClientImpl(SubscriptionCloudCredentials credentials, URI baseUri) + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (baseUri == null) + { + throw new NullPointerException("baseUri"); + } + this.credentials = credentials; + this.baseUri = baseUri; + + httpClient = credentials.initializeClient(); + } + + /** + * Initializes a new instance of the SchedulerManagementClientImpl class. + * + */ + @Inject + public SchedulerManagementClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CREDENTIALS) SubscriptionCloudCredentials credentials) throws java.net.URISyntaxException + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + this.credentials = credentials; + this.baseUri = new URI("https://management.core.windows.net/"); + + httpClient = credentials.initializeClient(); + } + + /** + * The Get Operation Status operation returns the status of thespecified + * operation. After calling an asynchronous operation, you can call Get + * Operation Status to determine whether the operation has succeeded, + * failed, or is still in progress. (see + * http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx for + * more information) + * + * @param requestId The request ID for the request you wish to track. The + * request ID is returned in the x-ms-request-id response header for every + * request. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public Future getOperationStatusAsync(final String requestId) + { + return this.getExecutorService().submit(new Callable() { + @Override + public SchedulerOperationStatusResponse call() throws Exception + { + return getOperationStatus(requestId); + } + }); + } + + /** + * The Get Operation Status operation returns the status of thespecified + * operation. After calling an asynchronous operation, you can call Get + * Operation Status to determine whether the operation has succeeded, + * failed, or is still in progress. (see + * http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx for + * more information) + * + * @param requestId The request ID for the request you wish to track. The + * request ID is returned in the x-ms-request-id response header for every + * request. + * @return The response body contains the status of the specified + * asynchronous operation, indicating whether it has succeeded, is + * inprogress, or has failed. Note that this status is distinct from the + * HTTP status code returned for the Get Operation Status operation itself. + * If the asynchronous operation succeeded, the response body includes the + * HTTP status code for the successful request. If the asynchronous + * operation failed, the response body includes the HTTP status code for + * the failed request, and also includes error information regarding the + * failure. + */ + @Override + public SchedulerOperationStatusResponse getOperationStatus(String requestId) throws IOException, ServiceException, ParserConfigurationException, SAXException + { + // Validate + if (requestId == null) + { + throw new NullPointerException("requestId"); + } + + // Tracing + + // Construct URL + String url = this.getBaseUri() + this.getCredentials().getSubscriptionId() + "/operations/" + requestId; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + SchedulerOperationStatusResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new SchedulerOperationStatusResponse(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document responseDoc = documentBuilder.parse(responseContent); + + NodeList elements = responseDoc.getElementsByTagName("Operation"); + Element operationElement = elements.getLength() > 0 ? ((Element)elements.item(0)) : null; + if (operationElement != null) + { + NodeList elements2 = operationElement.getElementsByTagName("ID"); + Element idElement = elements2.getLength() > 0 ? ((Element)elements2.item(0)) : null; + if (idElement != null) + { + String idInstance; + idInstance = idElement.getTextContent(); + result.setId(idInstance); + } + + NodeList elements3 = operationElement.getElementsByTagName("Status"); + Element statusElement = elements3.getLength() > 0 ? ((Element)elements3.item(0)) : null; + if (statusElement != null) + { + SchedulerOperationStatus statusInstance; + statusInstance = SchedulerOperationStatus.valueOf(statusElement.getTextContent()); + result.setStatus(statusInstance); + } + + NodeList elements4 = operationElement.getElementsByTagName("HttpStatusCode"); + Element httpStatusCodeElement = elements4.getLength() > 0 ? ((Element)elements4.item(0)) : null; + if (httpStatusCodeElement != null) + { + Integer httpStatusCodeInstance; + httpStatusCodeInstance = Integer.valueOf(httpStatusCodeElement.getTextContent()); + result.setHttpStatusCode(httpStatusCodeInstance); + } + + NodeList elements5 = operationElement.getElementsByTagName("Error"); + Element errorElement = elements5.getLength() > 0 ? ((Element)elements5.item(0)) : null; + if (errorElement != null) + { + SchedulerOperationStatusResponse.ErrorDetails errorInstance = new SchedulerOperationStatusResponse.ErrorDetails(); + result.setError(errorInstance); + + NodeList elements6 = errorElement.getElementsByTagName("Code"); + Element codeElement = elements6.getLength() > 0 ? ((Element)elements6.item(0)) : null; + if (codeElement != null) + { + String codeInstance; + codeInstance = codeElement.getTextContent(); + errorInstance.setCode(codeInstance); + } + + NodeList elements7 = errorElement.getElementsByTagName("Message"); + Element messageElement = elements7.getLength() > 0 ? ((Element)elements7.item(0)) : null; + if (messageElement != null) + { + String messageInstance; + messageInstance = messageElement.getTextContent(); + errorInstance.setMessage(messageInstance); + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Gets a list of properties for the resource provider, including supported + * regions and plans. + * + * @return The Resource Provider Get Properties operation response. + */ + @Override + public Future getResourceProviderPropertiesAsync() + { + return this.getExecutorService().submit(new Callable() { + @Override + public ResourceProviderGetPropertiesResponse call() throws Exception + { + return getResourceProviderProperties(); + } + }); + } + + /** + * Gets a list of properties for the resource provider, including supported + * regions and plans. + * + * @return The Resource Provider Get Properties operation response. + */ + @Override + public ResourceProviderGetPropertiesResponse getResourceProviderProperties() throws IOException, ServiceException, ParserConfigurationException, SAXException + { + // Validate + + // Tracing + + // Construct URL + String url = this.getBaseUri() + this.getCredentials().getSubscriptionId() + "/resourceproviders/" + "scheduler" + "/Properties?resourceType=" + "JobCollections"; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + ResourceProviderGetPropertiesResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new ResourceProviderGetPropertiesResponse(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document responseDoc = documentBuilder.parse(responseContent); + + NodeList elements = responseDoc.getElementsByTagName("ResourceProviderProperties"); + Element resourceProviderPropertiesSequenceElement = elements.getLength() > 0 ? ((Element)elements.item(0)) : null; + if (resourceProviderPropertiesSequenceElement != null) + { + for (int i1 = 0; i1 < resourceProviderPropertiesSequenceElement.getElementsByTagName("ResourceProviderProperty").getLength(); i1 = i1 + 1) + { + org.w3c.dom.Element resourceProviderPropertiesElement = ((org.w3c.dom.Element)resourceProviderPropertiesSequenceElement.getElementsByTagName("ResourceProviderProperty").item(i1)); + NodeList elements2 = resourceProviderPropertiesElement.getElementsByTagName("Key"); + String resourceProviderPropertiesKey = elements2.getLength() > 0 ? ((org.w3c.dom.Element)elements2.item(0)).getTextContent() : null; + NodeList elements3 = resourceProviderPropertiesElement.getElementsByTagName("Value"); + String resourceProviderPropertiesValue = elements3.getLength() > 0 ? ((org.w3c.dom.Element)elements3.item(0)).getTextContent() : null; + result.getProperties().put(resourceProviderPropertiesKey, resourceProviderPropertiesValue); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Register the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future registerResourceProviderAsync() + { + return this.getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return registerResourceProvider(); + } + }); + } + + /** + * Register the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse registerResourceProvider() throws IOException, ServiceException + { + // Validate + + // Tracing + + // Construct URL + String url = this.getBaseUri() + this.getCredentials().getSubscriptionId() + "/services?service=" + "scheduler" + "." + "JobCollections" + "&action=register"; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Unregister the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future unregisterResourceProviderAsync() + { + return this.getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return unregisterResourceProvider(); + } + }); + } + + /** + * Unregister the Scheduler resource provider with your subscription. + * + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse unregisterResourceProvider() throws IOException, ServiceException + { + // Validate + + // Tracing + + // Construct URL + String url = this.getBaseUri() + this.getCredentials().getSubscriptionId() + "/services?service=" + "scheduler" + "." + "JobCollections" + "&action=unregister"; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementService.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementService.java new file mode 100644 index 000000000000..8261d33139a0 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/SchedulerManagementService.java @@ -0,0 +1,70 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.management.scheduler; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access service management functionality. + * + */ +public class SchedulerManagementService { + + private SchedulerManagementService() { + // class is not instantiated + } + + /** + * Creates an instance of the SchedulerManagementClient API. + * + */ + public static SchedulerManagementClient create() { + return Configuration.getInstance().create(SchedulerManagementClient.class); + } + + /** + * Creates an instance of the SchedulerManagementClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static SchedulerManagementClient create(Configuration config) { + return config.create(SchedulerManagementClient.class); + } + + /** + * Creates an instance of the SchedulerManagementClient API. + * + * @param profile + * A String object that representing the profile of the service management service. + * + */ + public static SchedulerManagementClient create(String profile) { + return Configuration.getInstance().create(profile, SchedulerManagementClient.class); + } + + /** + * Creates an instance of the SchedulerManagementClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static SchedulerManagementClient create(String profile, Configuration config) { + return config.create(profile, SchedulerManagementClient.class); + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCheckNameAvailabilityResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCheckNameAvailabilityResponse.java new file mode 100644 index 000000000000..2bef3b441ec4 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCheckNameAvailabilityResponse.java @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Check Name Availability operation response. +*/ +public class JobCollectionCheckNameAvailabilityResponse extends OperationResponse +{ + private boolean isAvailable; + + /** + * Whether the name is available. + */ + public boolean getIsAvailable() { return this.isAvailable; } + + /** + * Whether the name is available. + */ + public void setIsAvailable(boolean isAvailable) { this.isAvailable = isAvailable; } + + /** + * Initializes a new instance of the + * JobCollectionCheckNameAvailabilityResponse class. + * + */ + public JobCollectionCheckNameAvailabilityResponse() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateParameters.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateParameters.java new file mode 100644 index 000000000000..3cfd38daddb9 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateParameters.java @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* Parameters supplied to the Create Job Collection operation. +*/ +public class JobCollectionCreateParameters +{ + private JobCollectionIntrinsicSettings intrinsicSettings; + + /** + * Intrinsic settings for the scheduler job collections. + */ + public JobCollectionIntrinsicSettings getIntrinsicSettings() { return this.intrinsicSettings; } + + /** + * Intrinsic settings for the scheduler job collections. + */ + public void setIntrinsicSettings(JobCollectionIntrinsicSettings intrinsicSettings) { this.intrinsicSettings = intrinsicSettings; } + + private String label; + + /** + * Label for the resource. + */ + public String getLabel() { return this.label; } + + /** + * Label for the resource. + */ + public void setLabel(String label) { this.label = label; } + + private String schemaVersion; + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public String getSchemaVersion() { return this.schemaVersion; } + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public void setSchemaVersion(String schemaVersion) { this.schemaVersion = schemaVersion; } + + /** + * Initializes a new instance of the JobCollectionCreateParameters class. + * + */ + public JobCollectionCreateParameters() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateResponse.java new file mode 100644 index 000000000000..85deb45af1e1 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionCreateResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Create Job Collection operation response. +*/ +public class JobCollectionCreateResponse extends OperationResponse +{ + private String eTag; + + /** + * ETag of the Job Collection. + */ + public String getETag() { return this.eTag; } + + /** + * ETag of the Job Collection. + */ + public void setETag(String eTag) { this.eTag = eTag; } + + /** + * Initializes a new instance of the JobCollectionCreateResponse class. + * + */ + public JobCollectionCreateResponse() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionGetResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionGetResponse.java new file mode 100644 index 000000000000..ef784c3d946f --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionGetResponse.java @@ -0,0 +1,265 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Get Job Collection operation response. +*/ +public class JobCollectionGetResponse extends OperationResponse +{ + private JobCollectionGetResponse.CloudServiceSettingInfo cloudServiceSettings; + + /** + * Settings for the Job Collection's containing Cloud Service. + */ + public JobCollectionGetResponse.CloudServiceSettingInfo getCloudServiceSettings() { return this.cloudServiceSettings; } + + /** + * Settings for the Job Collection's containing Cloud Service. + */ + public void setCloudServiceSettings(JobCollectionGetResponse.CloudServiceSettingInfo cloudServiceSettings) { this.cloudServiceSettings = cloudServiceSettings; } + + private String eTag; + + /** + * ETag of the Job Collection. + */ + public String getETag() { return this.eTag; } + + /** + * ETag of the Job Collection. + */ + public void setETag(String eTag) { this.eTag = eTag; } + + private JobCollectionIntrinsicSettings intrinsicSettings; + + /** + * Intrinsic settings for the scheduler job collections. + */ + public JobCollectionIntrinsicSettings getIntrinsicSettings() { return this.intrinsicSettings; } + + /** + * Intrinsic settings for the scheduler job collections. + */ + public void setIntrinsicSettings(JobCollectionIntrinsicSettings intrinsicSettings) { this.intrinsicSettings = intrinsicSettings; } + + private String label; + + /** + * Label for the resource. + */ + public String getLabel() { return this.label; } + + /** + * Label for the resource. + */ + public void setLabel(String label) { this.label = label; } + + private JobCollectionGetResponse.OperationStatus lastOperationStatus; + + /** + * The promotion code for buying the resource. + */ + public JobCollectionGetResponse.OperationStatus getLastOperationStatus() { return this.lastOperationStatus; } + + /** + * The promotion code for buying the resource. + */ + public void setLastOperationStatus(JobCollectionGetResponse.OperationStatus lastOperationStatus) { this.lastOperationStatus = lastOperationStatus; } + + private String name; + + /** + * Name of the Job Collection. + */ + public String getName() { return this.name; } + + /** + * Name of the Job Collection. + */ + public void setName(String name) { this.name = name; } + + private String plan; + + /** + * The plan of the resource. + */ + public String getPlan() { return this.plan; } + + /** + * The plan of the resource. + */ + public void setPlan(String plan) { this.plan = plan; } + + private String promotionCode; + + /** + * The promotion code for buying the resource. + */ + public String getPromotionCode() { return this.promotionCode; } + + /** + * The promotion code for buying the resource. + */ + public void setPromotionCode(String promotionCode) { this.promotionCode = promotionCode; } + + private String schemaVersion; + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public String getSchemaVersion() { return this.schemaVersion; } + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public void setSchemaVersion(String schemaVersion) { this.schemaVersion = schemaVersion; } + + private JobCollectionState state; + + /** + * State of the Job Collection. + */ + public JobCollectionState getState() { return this.state; } + + /** + * State of the Job Collection. + */ + public void setState(JobCollectionState state) { this.state = state; } + + /** + * Initializes a new instance of the JobCollectionGetResponse class. + * + */ + public JobCollectionGetResponse() + { + } + + /** + * Settings for the Job Collection's containing Cloud Service. + */ + public static class CloudServiceSettingInfo + { + private String geoRegion; + + /** + * GeoRegion of the cloud service. + */ + public String getGeoRegion() { return this.geoRegion; } + + /** + * GeoRegion of the cloud service. + */ + public void setGeoRegion(String geoRegion) { this.geoRegion = geoRegion; } + + /** + * Initializes a new instance of the CloudServiceSettingInfo class. + * + */ + public CloudServiceSettingInfo() + { + } + } + + /** + * Result of a previous operation. + */ + public static class OperationStatus + { + private JobCollectionGetResponse.OperationStatusResponseDetails responseDetails; + + /** + * Details about the last operation. + */ + public JobCollectionGetResponse.OperationStatusResponseDetails getResponseDetails() { return this.responseDetails; } + + /** + * Details about the last operation. + */ + public void setResponseDetails(JobCollectionGetResponse.OperationStatusResponseDetails responseDetails) { this.responseDetails = responseDetails; } + + private SchedulerOperationStatus status; + + /** + * Status of the last operation. + */ + public SchedulerOperationStatus getStatus() { return this.status; } + + /** + * Status of the last operation. + */ + public void setStatus(SchedulerOperationStatus status) { this.status = status; } + + /** + * Initializes a new instance of the OperationStatus class. + * + */ + public OperationStatus() + { + } + } + + /** + * Response details about an operation. + */ + public static class OperationStatusResponseDetails + { + private String message; + + /** + * Message returned by the operation. + */ + public String getMessage() { return this.message; } + + /** + * Message returned by the operation. + */ + public void setMessage(String message) { this.message = message; } + + private Integer statusCode; + + /** + * The HTTP status code of the operation. + */ + public Integer getStatusCode() { return this.statusCode; } + + /** + * The HTTP status code of the operation. + */ + public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } + + /** + * Initializes a new instance of the OperationStatusResponseDetails + * class. + * + */ + public OperationStatusResponseDetails() + { + } + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionIntrinsicSettings.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionIntrinsicSettings.java new file mode 100644 index 000000000000..22a5e05b3c13 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionIntrinsicSettings.java @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* Parameters supplied to intrinsic settings for a job. +*/ +public class JobCollectionIntrinsicSettings +{ + private JobCollectionPlan plan; + + /** + * The plan of the resource. + */ + public JobCollectionPlan getPlan() { return this.plan; } + + /** + * The plan of the resource. + */ + public void setPlan(JobCollectionPlan plan) { this.plan = plan; } + + private JobCollectionQuota quota; + + /** + * Quota settings for the job collection. + */ + public JobCollectionQuota getQuota() { return this.quota; } + + /** + * Quota settings for the job collection. + */ + public void setQuota(JobCollectionQuota quota) { this.quota = quota; } + + /** + * Initializes a new instance of the JobCollectionIntrinsicSettings class. + * + */ + public JobCollectionIntrinsicSettings() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionMaxRecurrence.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionMaxRecurrence.java new file mode 100644 index 000000000000..45c929f94a22 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionMaxRecurrence.java @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +public class JobCollectionMaxRecurrence +{ + private JobCollectionRecurrenceFrequency frequency; + + /** + * Defines the maximum recurrences that can be specified in any job in this + * job collection. + */ + public JobCollectionRecurrenceFrequency getFrequency() { return this.frequency; } + + /** + * Defines the maximum recurrences that can be specified in any job in this + * job collection. + */ + public void setFrequency(JobCollectionRecurrenceFrequency frequency) { this.frequency = frequency; } + + private int interval; + + /** + * Defines the interval. + */ + public int getInterval() { return this.interval; } + + /** + * Defines the interval. + */ + public void setInterval(int interval) { this.interval = interval; } + + /** + * Initializes a new instance of the JobCollectionMaxRecurrence class. + * + */ + public JobCollectionMaxRecurrence() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionPlan.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionPlan.java new file mode 100644 index 000000000000..bd20787213f0 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionPlan.java @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +public enum JobCollectionPlan +{ + Standard, + + Free, +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionQuota.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionQuota.java new file mode 100644 index 000000000000..638bd55e354c --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionQuota.java @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +public class JobCollectionQuota +{ + private Integer maxJobCount; + + /** + * Maximum number of jobs that can be created in this job collection. + * Maximum value is dependent on the plan. + */ + public Integer getMaxJobCount() { return this.maxJobCount; } + + /** + * Maximum number of jobs that can be created in this job collection. + * Maximum value is dependent on the plan. + */ + public void setMaxJobCount(Integer maxJobCount) { this.maxJobCount = maxJobCount; } + + private Integer maxJobOccurrence; + + /** + * Maximum number of occurrences for all jobs in the job collection. + */ + public Integer getMaxJobOccurrence() { return this.maxJobOccurrence; } + + /** + * Maximum number of occurrences for all jobs in the job collection. + */ + public void setMaxJobOccurrence(Integer maxJobOccurrence) { this.maxJobOccurrence = maxJobOccurrence; } + + private JobCollectionMaxRecurrence maxRecurrence; + + /** + * Defines the maximum recurrences that can be specified in any job in this + * job collection. + */ + public JobCollectionMaxRecurrence getMaxRecurrence() { return this.maxRecurrence; } + + /** + * Defines the maximum recurrences that can be specified in any job in this + * job collection. + */ + public void setMaxRecurrence(JobCollectionMaxRecurrence maxRecurrence) { this.maxRecurrence = maxRecurrence; } + + /** + * Initializes a new instance of the JobCollectionQuota class. + * + */ + public JobCollectionQuota() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionRecurrenceFrequency.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionRecurrenceFrequency.java new file mode 100644 index 000000000000..ff1554766986 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionRecurrenceFrequency.java @@ -0,0 +1,41 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* Maximum frequency that can be specified on any job in this job collection. +* Subset of acceptable frequencies is dependent on the plan. +*/ +public enum JobCollectionRecurrenceFrequency +{ + Minute, + + Hour, + + Day, + + Week, + + Month, + + Year, +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionState.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionState.java new file mode 100644 index 000000000000..62846c26ea58 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionState.java @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* State of the Job Collection resource. +*/ +public enum JobCollectionState +{ + /** + * Service Manager knows about the resource but the state is still Unknown + * which might either be a result of failed communication with the RP or + * just that the Service Manager hasn’t got around to process the resource. + */ + Unknown, + + /** + * The resource provider did not respond with information for the resource. + */ + NotFound, + + /** + * Resource is running fine. + */ + Started, + + /** + * Resource was stopped due to an issue. + */ + Stopped, + + /** + * The resource was temporarily put on hold primarily due to a monetary + * event. + */ + Paused, +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateParameters.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateParameters.java new file mode 100644 index 000000000000..eb1804ad4ab5 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateParameters.java @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* Parameters supplied to the Update Job Collection operation. +*/ +public class JobCollectionUpdateParameters +{ + private String eTag; + + /** + * The ETag of the job collection to update. The update will fail ifthe + * ETag doesn't match. + */ + public String getETag() { return this.eTag; } + + /** + * The ETag of the job collection to update. The update will fail ifthe + * ETag doesn't match. + */ + public void setETag(String eTag) { this.eTag = eTag; } + + private JobCollectionIntrinsicSettings intrinsicSettings; + + /** + * Intrinsic settings for the scheduler job collections. + */ + public JobCollectionIntrinsicSettings getIntrinsicSettings() { return this.intrinsicSettings; } + + /** + * Intrinsic settings for the scheduler job collections. + */ + public void setIntrinsicSettings(JobCollectionIntrinsicSettings intrinsicSettings) { this.intrinsicSettings = intrinsicSettings; } + + private String label; + + /** + * Label for the resource. + */ + public String getLabel() { return this.label; } + + /** + * Label for the resource. + */ + public void setLabel(String label) { this.label = label; } + + private String schemaVersion; + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public String getSchemaVersion() { return this.schemaVersion; } + + /** + * The version of the Intrinsic Properties for your Resource. If not + * specified, you must conform to the contract resource version you + * registered as default. + */ + public void setSchemaVersion(String schemaVersion) { this.schemaVersion = schemaVersion; } + + /** + * Initializes a new instance of the JobCollectionUpdateParameters class. + * + */ + public JobCollectionUpdateParameters() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateResponse.java new file mode 100644 index 000000000000..209f6e7c4062 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/JobCollectionUpdateResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Update Job Collection operation response. +*/ +public class JobCollectionUpdateResponse extends OperationResponse +{ + private String eTag; + + /** + * New ETag of the updated Job Collection. + */ + public String getETag() { return this.eTag; } + + /** + * New ETag of the updated Job Collection. + */ + public void setETag(String eTag) { this.eTag = eTag; } + + /** + * Initializes a new instance of the JobCollectionUpdateResponse class. + * + */ + public JobCollectionUpdateResponse() + { + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/ResourceProviderGetPropertiesResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/ResourceProviderGetPropertiesResponse.java new file mode 100644 index 000000000000..d12df6553e4a --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/ResourceProviderGetPropertiesResponse.java @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; +import java.util.HashMap; + +/** +* The Resource Provider Get Properties operation response. +*/ +public class ResourceProviderGetPropertiesResponse extends OperationResponse +{ + private HashMap properties; + + public HashMap getProperties() { return this.properties; } + + public void setProperties(HashMap properties) { this.properties = properties; } + + /** + * Initializes a new instance of the ResourceProviderGetPropertiesResponse + * class. + * + */ + public ResourceProviderGetPropertiesResponse() + { + this.properties = new HashMap(); + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatus.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatus.java new file mode 100644 index 000000000000..f1f7cd7864ef --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatus.java @@ -0,0 +1,43 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +/** +* The status of the asynchronous request. +*/ +public enum SchedulerOperationStatus +{ + /** + * The asynchronous request is in progress. + */ + InProgress, + + /** + * The asynchronous request succeeded. + */ + Succeeded, + + /** + * The asynchronous request failed. + */ + Failed, +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatusResponse.java b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatusResponse.java new file mode 100644 index 000000000000..0930c391f60e --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/models/SchedulerOperationStatusResponse.java @@ -0,0 +1,155 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.management.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The response body contains the status of the specified asynchronous +* operation, indicating whether it has succeeded, is inprogress, or has +* failed. Note that this status is distinct from the HTTP status code returned +* for the Get Operation Status operation itself. If the asynchronous +* operation succeeded, the response body includes the HTTP status code for the +* successful request. If the asynchronous operation failed, the response body +* includes the HTTP status code for the failed request, and also includes +* error information regarding the failure. +*/ +public class SchedulerOperationStatusResponse extends OperationResponse +{ + private SchedulerOperationStatusResponse.ErrorDetails error; + + /** + * If the asynchronous operation failed, the response body includes the HTTP + * status code for the failed request, and also includes error information + * regarding the failure. + */ + public SchedulerOperationStatusResponse.ErrorDetails getError() { return this.error; } + + /** + * If the asynchronous operation failed, the response body includes the HTTP + * status code for the failed request, and also includes error information + * regarding the failure. + */ + public void setError(SchedulerOperationStatusResponse.ErrorDetails error) { this.error = error; } + + private String eTag; + + /** + * Optional ETag, if returned from the original request. + */ + public String getETag() { return this.eTag; } + + /** + * Optional ETag, if returned from the original request. + */ + public void setETag(String eTag) { this.eTag = eTag; } + + private Integer httpStatusCode; + + /** + * The HTTP status code for the asynchronous request. + */ + public Integer getHttpStatusCode() { return this.httpStatusCode; } + + /** + * The HTTP status code for the asynchronous request. + */ + public void setHttpStatusCode(Integer httpStatusCode) { this.httpStatusCode = httpStatusCode; } + + private String id; + + /** + * The request ID of the asynchronous request. This value is returned in the + * x-ms-request-id response header of the asynchronous request. + */ + public String getId() { return this.id; } + + /** + * The request ID of the asynchronous request. This value is returned in the + * x-ms-request-id response header of the asynchronous request. + */ + public void setId(String id) { this.id = id; } + + private SchedulerOperationStatus status; + + /** + * The status of the asynchronous request. + */ + public SchedulerOperationStatus getStatus() { return this.status; } + + /** + * The status of the asynchronous request. + */ + public void setStatus(SchedulerOperationStatus status) { this.status = status; } + + /** + * Initializes a new instance of the SchedulerOperationStatusResponse class. + * + */ + public SchedulerOperationStatusResponse() + { + } + + /** + * If the asynchronous operation failed, the response body includes the HTTP + * status code for the failed request, and also includes error information + * regarding the failure. + */ + public static class ErrorDetails + { + private String code; + + /** + * The management service error code returned if the asynchronous + * request failed. + */ + public String getCode() { return this.code; } + + /** + * The management service error code returned if the asynchronous + * request failed. + */ + public void setCode(String code) { this.code = code; } + + private String message; + + /** + * The management service error message returned if the asynchronous + * request failed. + */ + public String getMessage() { return this.message; } + + /** + * The management service error message returned if the asynchronous + * request failed. + */ + public void setMessage(String message) { this.message = message; } + + /** + * Initializes a new instance of the ErrorDetails class. + * + */ + public ErrorDetails() + { + } + } +} diff --git a/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/package.html b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/package.html new file mode 100644 index 000000000000..e8dfd96862b7 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/java/com/microsoft/windowsazure/management/scheduler/package.html @@ -0,0 +1,6 @@ + + +This package contains the service management class, + interface, and associated configuration and utility classes. + + diff --git a/microsoft-azure-api-management-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-management-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports new file mode 100644 index 000000000000..d4c577c85d21 --- /dev/null +++ b/microsoft-azure-api-management-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -0,0 +1 @@ +com.microsoft.windowsazure.management.scheduler.Exports diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NamespaceOperationsImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NamespaceOperationsImpl.java index 19e744e7fcbe..82c0eca5b4be 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NamespaceOperationsImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NamespaceOperationsImpl.java @@ -34,6 +34,7 @@ import com.microsoft.windowsazure.management.servicebus.models.ServiceBusSharedAccessAuthorizationRule; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -56,7 +57,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; @@ -103,11 +103,12 @@ public class NamespaceOperationsImpl implements ServiceOperations checkAvailabilityAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public CheckNamespaceAvailabilityResponse call() throws Exception - { - return checkAvailability(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public CheckNamespaceAvailabilityResponse call() throws Exception + { + return checkAvailability(namespaceName); + } }); } @@ -211,11 +212,12 @@ public CheckNamespaceAvailabilityResponse checkAvailability(String namespaceName @Override public Future createAsync(final String namespaceName, final String region) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNamespaceResponse call() throws Exception - { - return create(namespaceName, region); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNamespaceResponse call() throws Exception + { + return create(namespaceName, region); + } }); } @@ -411,11 +413,12 @@ public ServiceBusNamespaceResponse create(String namespaceName, String region) t @Override public Future createAuthorizationRuleAsync(final String namespaceName, final ServiceBusSharedAccessAuthorizationRule rule) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusAuthorizationRuleResponse call() throws Exception - { - return createAuthorizationRule(namespaceName, rule); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusAuthorizationRuleResponse call() throws Exception + { + return createAuthorizationRule(namespaceName, rule); + } }); } @@ -684,11 +687,12 @@ public ServiceBusAuthorizationRuleResponse createAuthorizationRule(String namesp @Override public Future deleteAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(namespaceName); + } }); } @@ -713,7 +717,7 @@ public OperationResponse delete(String namespaceName) throws IOException, Servic String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/servicebus/namespaces/" + namespaceName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("Accept", "application/atom+xml"); @@ -752,11 +756,12 @@ public OperationResponse delete(String namespaceName) throws IOException, Servic @Override public Future deleteAuthorizationRuleAsync(final String namespaceName, final String ruleName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return deleteAuthorizationRule(namespaceName, ruleName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return deleteAuthorizationRule(namespaceName, ruleName); + } }); } @@ -786,7 +791,7 @@ public OperationResponse deleteAuthorizationRule(String namespaceName, String ru String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/servicebus/namespaces/" + namespaceName + "/AuthorizationRules/" + ruleName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2012-03-01"); @@ -823,11 +828,12 @@ public OperationResponse deleteAuthorizationRule(String namespaceName, String ru @Override public Future getAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNamespaceResponse call() throws Exception - { - return get(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNamespaceResponse call() throws Exception + { + return get(namespaceName); + } }); } @@ -988,11 +994,12 @@ public ServiceBusNamespaceResponse get(String namespaceName) throws IOException, @Override public Future getAuthorizationRuleAsync(final String namespaceName, final String entityName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusAuthorizationRuleResponse call() throws Exception - { - return getAuthorizationRule(namespaceName, entityName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusAuthorizationRuleResponse call() throws Exception + { + return getAuthorizationRule(namespaceName, entityName); + } }); } @@ -1177,11 +1184,12 @@ public ServiceBusAuthorizationRuleResponse getAuthorizationRule(String namespace @Override public Future getNamespaceDescriptionAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNamespaceDescriptionResponse call() throws Exception - { - return getNamespaceDescription(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNamespaceDescriptionResponse call() throws Exception + { + return getNamespaceDescription(namespaceName); + } }); } @@ -1322,11 +1330,12 @@ public ServiceBusNamespaceDescriptionResponse getNamespaceDescription(String nam @Override public Future listAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNamespacesResponse call() throws Exception - { - return list(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNamespacesResponse call() throws Exception + { + return list(); + } }); } @@ -1493,11 +1502,12 @@ public ServiceBusNamespacesResponse list() throws IOException, ServiceException, @Override public Future listAuthorizationRulesAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusAuthorizationRulesResponse call() throws Exception - { - return listAuthorizationRules(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusAuthorizationRulesResponse call() throws Exception + { + return listAuthorizationRules(namespaceName); + } }); } @@ -1681,11 +1691,12 @@ public ServiceBusAuthorizationRulesResponse listAuthorizationRules(String namesp @Override public Future updateAuthorizationRuleAsync(final String namespaceName, final ServiceBusSharedAccessAuthorizationRule rule) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusAuthorizationRuleResponse call() throws Exception - { - return updateAuthorizationRule(namespaceName, rule); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusAuthorizationRuleResponse call() throws Exception + { + return updateAuthorizationRule(namespaceName, rule); + } }); } diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NotificationHubOperationsImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NotificationHubOperationsImpl.java index 0e1c24f28249..2935c3b504ff 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NotificationHubOperationsImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/NotificationHubOperationsImpl.java @@ -81,11 +81,12 @@ public class NotificationHubOperationsImpl implements ServiceOperations getAsync(final String namespaceName, final String notificationHubName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNotificationHubResponse call() throws Exception - { - return get(namespaceName, notificationHubName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNotificationHubResponse call() throws Exception + { + return get(namespaceName, notificationHubName); + } }); } @@ -272,11 +273,12 @@ public ServiceBusNotificationHubResponse get(String namespaceName, String notifi @Override public Future getConnectionDetailsAsync(final String namespaceName, final String notificationHubName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusConnectionDetailsResponse call() throws Exception - { - return getConnectionDetails(namespaceName, notificationHubName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusConnectionDetailsResponse call() throws Exception + { + return getConnectionDetails(namespaceName, notificationHubName); + } }); } @@ -401,11 +403,12 @@ public ServiceBusConnectionDetailsResponse getConnectionDetails(String namespace @Override public Future listAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusNotificationHubsResponse call() throws Exception - { - return list(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusNotificationHubsResponse call() throws Exception + { + return list(namespaceName); + } }); } diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/QueueOperationsImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/QueueOperationsImpl.java index 2adc4dc5486d..c2e3dfd17b93 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/QueueOperationsImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/QueueOperationsImpl.java @@ -39,6 +39,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.TimeZone; import java.util.concurrent.Callable; import java.util.concurrent.Future; import javax.xml.parsers.DocumentBuilder; @@ -96,11 +97,12 @@ public class QueueOperationsImpl implements ServiceOperations createAsync(final String namespaceName, final ServiceBusQueue queue) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusQueueResponse call() throws Exception - { - return create(namespaceName, queue); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusQueueResponse call() throws Exception + { + return create(namespaceName, queue); + } }); } @@ -252,7 +254,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu } Element createdTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); - createdTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getCreatedTime().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + createdTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()))); authorizationRuleElement.appendChild(createdTimeElement); if (authorizationRulesItem.getKeyName() != null) @@ -263,7 +267,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu } Element modifiedTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); - modifiedTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getModifiedTime().toString())); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + modifiedTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()))); authorizationRuleElement.appendChild(modifiedTimeElement); if (authorizationRulesItem.getPrimaryKey() != null) @@ -291,15 +297,21 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu } Element createdAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedAt"); - createdAtElement.appendChild(requestDoc.createTextNode(queue.getCreatedAt().toString())); + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat3.setTimeZone(TimeZone.getTimeZone("UTC")); + createdAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat3.format(queue.getCreatedAt().getTime()))); queueDescriptionElement.appendChild(createdAtElement); Element updatedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "UpdatedAt"); - updatedAtElement.appendChild(requestDoc.createTextNode(queue.getUpdatedAt().toString())); + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat4.setTimeZone(TimeZone.getTimeZone("UTC")); + updatedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat4.format(queue.getUpdatedAt().getTime()))); queueDescriptionElement.appendChild(updatedAtElement); Element accessedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessedAt"); - accessedAtElement.appendChild(requestDoc.createTextNode(queue.getAccessedAt().toString())); + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat5.setTimeZone(TimeZone.getTimeZone("UTC")); + accessedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat5.format(queue.getAccessedAt().getTime()))); queueDescriptionElement.appendChild(accessedAtElement); Element supportOrderingElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); @@ -549,9 +561,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu if (createdTimeElement2 != null) { Calendar createdTimeInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(createdTimeElement2.getTextContent())); + calendar.setTime(simpleDateFormat6.parse(createdTimeElement2.getTextContent())); createdTimeInstance = calendar; authorizationRuleInstance.setCreatedTime(createdTimeInstance); } @@ -570,9 +582,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu if (modifiedTimeElement2 != null) { Calendar modifiedTimeInstance; - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat7 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar2 = Calendar.getInstance(); - calendar2.setTime(simpleDateFormat2.parse(modifiedTimeElement2.getTextContent())); + calendar2.setTime(simpleDateFormat7.parse(modifiedTimeElement2.getTextContent())); modifiedTimeInstance = calendar2; authorizationRuleInstance.setModifiedTime(modifiedTimeInstance); } @@ -611,9 +623,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu if (createdAtElement2 != null) { Calendar createdAtInstance; - SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat8 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar3 = Calendar.getInstance(); - calendar3.setTime(simpleDateFormat3.parse(createdAtElement2.getTextContent())); + calendar3.setTime(simpleDateFormat8.parse(createdAtElement2.getTextContent())); createdAtInstance = calendar3; queueDescriptionInstance.setCreatedAt(createdAtInstance); } @@ -623,9 +635,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu if (updatedAtElement2 != null) { Calendar updatedAtInstance; - SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat9 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar4 = Calendar.getInstance(); - calendar4.setTime(simpleDateFormat4.parse(updatedAtElement2.getTextContent())); + calendar4.setTime(simpleDateFormat9.parse(updatedAtElement2.getTextContent())); updatedAtInstance = calendar4; queueDescriptionInstance.setUpdatedAt(updatedAtInstance); } @@ -635,9 +647,9 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu if (accessedAtElement2 != null) { Calendar accessedAtInstance; - SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat10 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar5 = Calendar.getInstance(); - calendar5.setTime(simpleDateFormat5.parse(accessedAtElement2.getTextContent())); + calendar5.setTime(simpleDateFormat10.parse(accessedAtElement2.getTextContent())); accessedAtInstance = calendar5; queueDescriptionInstance.setAccessedAt(accessedAtInstance); } @@ -747,11 +759,12 @@ public ServiceBusQueueResponse create(String namespaceName, ServiceBusQueue queu @Override public Future getAsync(final String namespaceName, final String queueName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusQueueResponse call() throws Exception - { - return get(namespaceName, queueName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusQueueResponse call() throws Exception + { + return get(namespaceName, queueName); + } }); } @@ -1167,11 +1180,12 @@ public ServiceBusQueueResponse get(String namespaceName, String queueName) throw @Override public Future getConnectionDetailsAsync(final String namespaceName, final String queueName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusConnectionDetailsResponse call() throws Exception - { - return getConnectionDetails(namespaceName, queueName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusConnectionDetailsResponse call() throws Exception + { + return getConnectionDetails(namespaceName, queueName); + } }); } @@ -1301,11 +1315,12 @@ public ServiceBusConnectionDetailsResponse getConnectionDetails(String namespace @Override public Future listAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusQueuesResponse call() throws Exception - { - return list(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusQueuesResponse call() throws Exception + { + return list(namespaceName); + } }); } @@ -1734,11 +1749,12 @@ public ServiceBusQueuesResponse list(String namespaceName) throws IOException, S @Override public Future updateAsync(final String namespaceName, final ServiceBusQueue queue) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusQueueResponse call() throws Exception - { - return update(namespaceName, queue); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusQueueResponse call() throws Exception + { + return update(namespaceName, queue); + } }); } @@ -1883,7 +1899,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu } Element createdTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); - createdTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getCreatedTime().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + createdTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()))); authorizationRuleElement.appendChild(createdTimeElement); if (authorizationRulesItem.getKeyName() != null) @@ -1894,7 +1912,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu } Element modifiedTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); - modifiedTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getModifiedTime().toString())); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + modifiedTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()))); authorizationRuleElement.appendChild(modifiedTimeElement); if (authorizationRulesItem.getPrimaryKey() != null) @@ -1922,15 +1942,21 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu } Element createdAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedAt"); - createdAtElement.appendChild(requestDoc.createTextNode(queue.getCreatedAt().toString())); + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat3.setTimeZone(TimeZone.getTimeZone("UTC")); + createdAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat3.format(queue.getCreatedAt().getTime()))); queueDescriptionElement.appendChild(createdAtElement); Element updatedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "UpdatedAt"); - updatedAtElement.appendChild(requestDoc.createTextNode(queue.getUpdatedAt().toString())); + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat4.setTimeZone(TimeZone.getTimeZone("UTC")); + updatedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat4.format(queue.getUpdatedAt().getTime()))); queueDescriptionElement.appendChild(updatedAtElement); Element accessedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessedAt"); - accessedAtElement.appendChild(requestDoc.createTextNode(queue.getAccessedAt().toString())); + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat5.setTimeZone(TimeZone.getTimeZone("UTC")); + accessedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat5.format(queue.getAccessedAt().getTime()))); queueDescriptionElement.appendChild(accessedAtElement); Element supportOrderingElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); @@ -2181,9 +2207,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu if (createdTimeElement2 != null) { Calendar createdTimeInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(createdTimeElement2.getTextContent())); + calendar.setTime(simpleDateFormat6.parse(createdTimeElement2.getTextContent())); createdTimeInstance = calendar; authorizationRuleInstance.setCreatedTime(createdTimeInstance); } @@ -2202,9 +2228,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu if (modifiedTimeElement2 != null) { Calendar modifiedTimeInstance; - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat7 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar2 = Calendar.getInstance(); - calendar2.setTime(simpleDateFormat2.parse(modifiedTimeElement2.getTextContent())); + calendar2.setTime(simpleDateFormat7.parse(modifiedTimeElement2.getTextContent())); modifiedTimeInstance = calendar2; authorizationRuleInstance.setModifiedTime(modifiedTimeInstance); } @@ -2243,9 +2269,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu if (createdAtElement2 != null) { Calendar createdAtInstance; - SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat8 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar3 = Calendar.getInstance(); - calendar3.setTime(simpleDateFormat3.parse(createdAtElement2.getTextContent())); + calendar3.setTime(simpleDateFormat8.parse(createdAtElement2.getTextContent())); createdAtInstance = calendar3; queueDescriptionInstance.setCreatedAt(createdAtInstance); } @@ -2255,9 +2281,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu if (updatedAtElement2 != null) { Calendar updatedAtInstance; - SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat9 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar4 = Calendar.getInstance(); - calendar4.setTime(simpleDateFormat4.parse(updatedAtElement2.getTextContent())); + calendar4.setTime(simpleDateFormat9.parse(updatedAtElement2.getTextContent())); updatedAtInstance = calendar4; queueDescriptionInstance.setUpdatedAt(updatedAtInstance); } @@ -2267,9 +2293,9 @@ public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queu if (accessedAtElement2 != null) { Calendar accessedAtInstance; - SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat10 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar5 = Calendar.getInstance(); - calendar5.setTime(simpleDateFormat5.parse(accessedAtElement2.getTextContent())); + calendar5.setTime(simpleDateFormat10.parse(accessedAtElement2.getTextContent())); accessedAtInstance = calendar5; queueDescriptionInstance.setAccessedAt(accessedAtInstance); } diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/RelayOperationsImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/RelayOperationsImpl.java index 6dc7dd1773e2..0d7f8d588b8e 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/RelayOperationsImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/RelayOperationsImpl.java @@ -72,11 +72,12 @@ public class RelayOperationsImpl implements ServiceOperations getConnectionDetailsAsync(final String namespaceName, final String relayName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusConnectionDetailsResponse call() throws Exception - { - return getConnectionDetails(namespaceName, relayName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusConnectionDetailsResponse call() throws Exception + { + return getConnectionDetails(namespaceName, relayName); + } }); } diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/ServiceBusManagementClientImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/ServiceBusManagementClientImpl.java index 73805e4a92d4..6e7fa822f495 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/ServiceBusManagementClientImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/ServiceBusManagementClientImpl.java @@ -203,11 +203,12 @@ public ServiceBusManagementClientImpl(@Named(ManagementConfiguration.SUBSCRIPTIO @Override public Future getOperationStatusAsync(final String requestId) { - return this.getExecutorService().submit(new Callable() { @Override - public ServiceBusOperationStatusResponse call() throws Exception - { - return getOperationStatus(requestId); - } + return this.getExecutorService().submit(new Callable() { + @Override + public ServiceBusOperationStatusResponse call() throws Exception + { + return getOperationStatus(requestId); + } }); } @@ -349,11 +350,12 @@ public ServiceBusOperationStatusResponse getOperationStatus(String requestId) th @Override public Future getServiceBusRegionsAsync() { - return this.getExecutorService().submit(new Callable() { @Override - public ServiceBusRegionsResponse call() throws Exception - { - return getServiceBusRegions(); - } + return this.getExecutorService().submit(new Callable() { + @Override + public ServiceBusRegionsResponse call() throws Exception + { + return getServiceBusRegions(); + } }); } diff --git a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/TopicOperationsImpl.java b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/TopicOperationsImpl.java index 25af50ff96f6..8014cc51a551 100644 --- a/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/TopicOperationsImpl.java +++ b/microsoft-azure-api-management-serviceBus/src/main/java/com/microsoft/windowsazure/management/serviceBus/TopicOperationsImpl.java @@ -39,6 +39,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.TimeZone; import java.util.concurrent.Callable; import java.util.concurrent.Future; import javax.xml.parsers.DocumentBuilder; @@ -96,11 +97,12 @@ public class TopicOperationsImpl implements ServiceOperations createAsync(final String namespaceName, final ServiceBusTopic topic) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusTopicResponse call() throws Exception - { - return create(namespaceName, topic); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusTopicResponse call() throws Exception + { + return create(namespaceName, topic); + } }); } @@ -227,7 +229,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi } Element createdTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); - createdTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getCreatedTime().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + createdTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()))); authorizationRuleElement.appendChild(createdTimeElement); if (authorizationRulesItem.getKeyName() != null) @@ -238,7 +242,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi } Element modifiedTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); - modifiedTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getModifiedTime().toString())); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + modifiedTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()))); authorizationRuleElement.appendChild(modifiedTimeElement); if (authorizationRulesItem.getPrimaryKey() != null) @@ -266,15 +272,21 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi } Element createdAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedAt"); - createdAtElement.appendChild(requestDoc.createTextNode(topic.getCreatedAt().toString())); + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat3.setTimeZone(TimeZone.getTimeZone("UTC")); + createdAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat3.format(topic.getCreatedAt().getTime()))); topicDescriptionElement.appendChild(createdAtElement); Element updatedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "UpdatedAt"); - updatedAtElement.appendChild(requestDoc.createTextNode(topic.getUpdatedAt().toString())); + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat4.setTimeZone(TimeZone.getTimeZone("UTC")); + updatedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat4.format(topic.getUpdatedAt().getTime()))); topicDescriptionElement.appendChild(updatedAtElement); Element accessedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessedAt"); - accessedAtElement.appendChild(requestDoc.createTextNode(topic.getAccessedAt().toString())); + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat5.setTimeZone(TimeZone.getTimeZone("UTC")); + accessedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat5.format(topic.getAccessedAt().getTime()))); topicDescriptionElement.appendChild(accessedAtElement); Element supportOrderingElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); @@ -493,9 +505,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi if (createdTimeElement2 != null) { Calendar createdTimeInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(createdTimeElement2.getTextContent())); + calendar.setTime(simpleDateFormat6.parse(createdTimeElement2.getTextContent())); createdTimeInstance = calendar; authorizationRuleInstance.setCreatedTime(createdTimeInstance); } @@ -514,9 +526,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi if (modifiedTimeElement2 != null) { Calendar modifiedTimeInstance; - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat7 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar2 = Calendar.getInstance(); - calendar2.setTime(simpleDateFormat2.parse(modifiedTimeElement2.getTextContent())); + calendar2.setTime(simpleDateFormat7.parse(modifiedTimeElement2.getTextContent())); modifiedTimeInstance = calendar2; authorizationRuleInstance.setModifiedTime(modifiedTimeInstance); } @@ -555,9 +567,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi if (createdAtElement2 != null) { Calendar createdAtInstance; - SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat8 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar3 = Calendar.getInstance(); - calendar3.setTime(simpleDateFormat3.parse(createdAtElement2.getTextContent())); + calendar3.setTime(simpleDateFormat8.parse(createdAtElement2.getTextContent())); createdAtInstance = calendar3; topicDescriptionInstance.setCreatedAt(createdAtInstance); } @@ -567,9 +579,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi if (updatedAtElement2 != null) { Calendar updatedAtInstance; - SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat9 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar4 = Calendar.getInstance(); - calendar4.setTime(simpleDateFormat4.parse(updatedAtElement2.getTextContent())); + calendar4.setTime(simpleDateFormat9.parse(updatedAtElement2.getTextContent())); updatedAtInstance = calendar4; topicDescriptionInstance.setUpdatedAt(updatedAtInstance); } @@ -579,9 +591,9 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi if (accessedAtElement2 != null) { Calendar accessedAtInstance; - SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat10 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar5 = Calendar.getInstance(); - calendar5.setTime(simpleDateFormat5.parse(accessedAtElement2.getTextContent())); + calendar5.setTime(simpleDateFormat10.parse(accessedAtElement2.getTextContent())); accessedAtInstance = calendar5; topicDescriptionInstance.setAccessedAt(accessedAtInstance); } @@ -655,11 +667,12 @@ public ServiceBusTopicResponse create(String namespaceName, ServiceBusTopic topi @Override public Future getAsync(final String namespaceName, final String topicName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusTopicResponse call() throws Exception - { - return get(namespaceName, topicName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusTopicResponse call() throws Exception + { + return get(namespaceName, topicName); + } }); } @@ -1003,11 +1016,12 @@ public ServiceBusTopicResponse get(String namespaceName, String topicName) throw @Override public Future getConnectionDetailsAsync(final String namespaceName, final String topicName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusConnectionDetailsResponse call() throws Exception - { - return getConnectionDetails(namespaceName, topicName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusConnectionDetailsResponse call() throws Exception + { + return getConnectionDetails(namespaceName, topicName); + } }); } @@ -1135,11 +1149,12 @@ public ServiceBusConnectionDetailsResponse getConnectionDetails(String namespace @Override public Future listAsync(final String namespaceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusTopicsResponse call() throws Exception - { - return list(namespaceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusTopicsResponse call() throws Exception + { + return list(namespaceName); + } }); } @@ -1493,11 +1508,12 @@ public ServiceBusTopicsResponse list(String namespaceName) throws IOException, S @Override public Future updateAsync(final String namespaceName, final ServiceBusTopic topic) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceBusTopicResponse call() throws Exception - { - return update(namespaceName, topic); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceBusTopicResponse call() throws Exception + { + return update(namespaceName, topic); + } }); } @@ -1622,7 +1638,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi } Element createdTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); - createdTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getCreatedTime().toString())); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + createdTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()))); authorizationRuleElement.appendChild(createdTimeElement); if (authorizationRulesItem.getKeyName() != null) @@ -1633,7 +1651,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi } Element modifiedTimeElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); - modifiedTimeElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getModifiedTime().toString())); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + modifiedTimeElement.appendChild(requestDoc.createTextNode(simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()))); authorizationRuleElement.appendChild(modifiedTimeElement); if (authorizationRulesItem.getPrimaryKey() != null) @@ -1661,15 +1681,21 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi } Element createdAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedAt"); - createdAtElement.appendChild(requestDoc.createTextNode(topic.getCreatedAt().toString())); + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat3.setTimeZone(TimeZone.getTimeZone("UTC")); + createdAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat3.format(topic.getCreatedAt().getTime()))); topicDescriptionElement.appendChild(createdAtElement); Element updatedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "UpdatedAt"); - updatedAtElement.appendChild(requestDoc.createTextNode(topic.getUpdatedAt().toString())); + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat4.setTimeZone(TimeZone.getTimeZone("UTC")); + updatedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat4.format(topic.getUpdatedAt().getTime()))); topicDescriptionElement.appendChild(updatedAtElement); Element accessedAtElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessedAt"); - accessedAtElement.appendChild(requestDoc.createTextNode(topic.getAccessedAt().toString())); + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat5.setTimeZone(TimeZone.getTimeZone("UTC")); + accessedAtElement.appendChild(requestDoc.createTextNode(simpleDateFormat5.format(topic.getAccessedAt().getTime()))); topicDescriptionElement.appendChild(accessedAtElement); Element supportOrderingElement = requestDoc.createElementNS("http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); @@ -1888,9 +1914,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi if (createdTimeElement2 != null) { Calendar createdTimeInstance; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar = Calendar.getInstance(); - calendar.setTime(simpleDateFormat.parse(createdTimeElement2.getTextContent())); + calendar.setTime(simpleDateFormat6.parse(createdTimeElement2.getTextContent())); createdTimeInstance = calendar; authorizationRuleInstance.setCreatedTime(createdTimeInstance); } @@ -1909,9 +1935,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi if (modifiedTimeElement2 != null) { Calendar modifiedTimeInstance; - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat7 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar2 = Calendar.getInstance(); - calendar2.setTime(simpleDateFormat2.parse(modifiedTimeElement2.getTextContent())); + calendar2.setTime(simpleDateFormat7.parse(modifiedTimeElement2.getTextContent())); modifiedTimeInstance = calendar2; authorizationRuleInstance.setModifiedTime(modifiedTimeInstance); } @@ -1950,9 +1976,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi if (createdAtElement2 != null) { Calendar createdAtInstance; - SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat8 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar3 = Calendar.getInstance(); - calendar3.setTime(simpleDateFormat3.parse(createdAtElement2.getTextContent())); + calendar3.setTime(simpleDateFormat8.parse(createdAtElement2.getTextContent())); createdAtInstance = calendar3; topicDescriptionInstance.setCreatedAt(createdAtInstance); } @@ -1962,9 +1988,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi if (updatedAtElement2 != null) { Calendar updatedAtInstance; - SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat9 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar4 = Calendar.getInstance(); - calendar4.setTime(simpleDateFormat4.parse(updatedAtElement2.getTextContent())); + calendar4.setTime(simpleDateFormat9.parse(updatedAtElement2.getTextContent())); updatedAtInstance = calendar4; topicDescriptionInstance.setUpdatedAt(updatedAtInstance); } @@ -1974,9 +2000,9 @@ public ServiceBusTopicResponse update(String namespaceName, ServiceBusTopic topi if (accessedAtElement2 != null) { Calendar accessedAtInstance; - SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + SimpleDateFormat simpleDateFormat10 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); Calendar calendar5 = Calendar.getInstance(); - calendar5.setTime(simpleDateFormat5.parse(accessedAtElement2.getTextContent())); + calendar5.setTime(simpleDateFormat10.parse(accessedAtElement2.getTextContent())); accessedAtInstance = calendar5; topicDescriptionInstance.setAccessedAt(accessedAtInstance); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DacOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DacOperationsImpl.java index f6a4ae17f5da..81aed85b9f80 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DacOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DacOperationsImpl.java @@ -89,11 +89,12 @@ public class DacOperationsImpl implements ServiceOperations exportAsync(final String serverName, final DacExportParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DacImportExportResponse call() throws Exception - { - return export(serverName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DacImportExportResponse call() throws Exception + { + return export(serverName, parameters); + } }); } @@ -267,11 +268,12 @@ public DacImportExportResponse export(String serverName, DacExportParameters par @Override public Future getStatusAsync(final String serverName, final String fullyQualifiedServerName, final String username, final String password, final String requestId) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DacGetStatusResponse call() throws Exception - { - return getStatus(serverName, fullyQualifiedServerName, username, password, requestId); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DacGetStatusResponse call() throws Exception + { + return getStatus(serverName, fullyQualifiedServerName, username, password, requestId); + } }); } @@ -470,11 +472,12 @@ public DacGetStatusResponse getStatus(String serverName, String fullyQualifiedSe @Override public Future importResourceAsync(final String serverName, final DacImportParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DacImportExportResponse call() throws Exception - { - return importResource(serverName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DacImportExportResponse call() throws Exception + { + return importResource(serverName, parameters); + } }); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationOperationsImpl.java index 53d9c34cf1a8..59d919c3e275 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationOperationsImpl.java @@ -80,11 +80,12 @@ public class DatabaseOperationOperationsImpl implements ServiceOperations getAsync(final String serverName, final String operationGuid) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseOperationGetResponse call() throws Exception - { - return get(serverName, operationGuid); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseOperationGetResponse call() throws Exception + { + return get(serverName, operationGuid); + } }); } @@ -316,11 +317,12 @@ public DatabaseOperationGetResponse get(String serverName, String operationGuid) @Override public Future listByDatabaseAsync(final String serverName, final String databaseName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseOperationListResponse call() throws Exception - { - return listByDatabase(serverName, databaseName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseOperationListResponse call() throws Exception + { + return listByDatabase(serverName, databaseName); + } }); } @@ -554,11 +556,12 @@ public DatabaseOperationListResponse listByDatabase(String serverName, String da @Override public Future listByServerAsync(final String serverName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseOperationListResponse call() throws Exception - { - return listByServer(serverName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseOperationListResponse call() throws Exception + { + return listByServer(serverName); + } }); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationsImpl.java index 8f5df9a3ea5d..f8eef552e6ba 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperationsImpl.java @@ -30,6 +30,7 @@ import com.microsoft.windowsazure.management.sql.models.DatabaseUpdateResponse; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -49,7 +50,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; @@ -96,11 +96,12 @@ public class DatabaseOperationsImpl implements ServiceOperations createAsync(final String serverName, final DatabaseCreateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseCreateResponse call() throws Exception - { - return create(serverName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseCreateResponse call() throws Exception + { + return create(serverName, parameters); + } }); } @@ -397,11 +398,12 @@ public DatabaseCreateResponse create(String serverName, DatabaseCreateParameters @Override public Future deleteAsync(final String serverName, final String databaseName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(serverName, databaseName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(serverName, databaseName); + } }); } @@ -435,7 +437,7 @@ public OperationResponse delete(String serverName, String databaseName) throws I String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/sqlservers/servers/" + serverName + "/databases/" + databaseName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2012-03-01"); @@ -475,11 +477,12 @@ public OperationResponse delete(String serverName, String databaseName) throws I @Override public Future getAsync(final String serverName, final String databaseName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseGetResponse call() throws Exception - { - return get(serverName, databaseName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseGetResponse call() throws Exception + { + return get(serverName, databaseName); + } }); } @@ -714,11 +717,12 @@ public DatabaseGetResponse get(String serverName, String databaseName) throws IO @Override public Future listAsync(final String serverName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseListResponse call() throws Exception - { - return list(serverName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseListResponse call() throws Exception + { + return list(serverName); + } }); } @@ -956,11 +960,12 @@ public DatabaseListResponse list(String serverName) throws IOException, ServiceE @Override public Future updateAsync(final String serverName, final String databaseName, final DatabaseUpdateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public DatabaseUpdateResponse call() throws Exception - { - return update(serverName, databaseName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public DatabaseUpdateResponse call() throws Exception + { + return update(serverName, databaseName, parameters); + } }); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/FirewallRuleOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/FirewallRuleOperationsImpl.java index 16a5a8b050e7..afca3636e712 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/FirewallRuleOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/FirewallRuleOperationsImpl.java @@ -29,6 +29,7 @@ import com.microsoft.windowsazure.management.sql.models.FirewallRuleUpdateResponse; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -47,7 +48,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; @@ -102,11 +102,12 @@ public class FirewallRuleOperationsImpl implements ServiceOperations createAsync(final String serverName, final FirewallRuleCreateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public FirewallRuleCreateResponse call() throws Exception - { - return create(serverName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public FirewallRuleCreateResponse call() throws Exception + { + return create(serverName, parameters); + } }); } @@ -285,11 +286,12 @@ public FirewallRuleCreateResponse create(String serverName, FirewallRuleCreatePa @Override public Future deleteAsync(final String serverName, final String ruleName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(serverName, ruleName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(serverName, ruleName); + } }); } @@ -324,7 +326,7 @@ public OperationResponse delete(String serverName, String ruleName) throws IOExc String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/sqlservers/servers/" + serverName + "/firewallrules/" + ruleName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2012-03-01"); @@ -365,11 +367,12 @@ public OperationResponse delete(String serverName, String ruleName) throws IOExc @Override public Future listAsync(final String serverName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public FirewallRuleListResponse call() throws Exception - { - return list(serverName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public FirewallRuleListResponse call() throws Exception + { + return list(serverName); + } }); } @@ -497,11 +500,12 @@ public FirewallRuleListResponse list(String serverName) throws IOException, Serv @Override public Future updateAsync(final String serverName, final String ruleName, final FirewallRuleUpdateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public FirewallRuleUpdateResponse call() throws Exception - { - return update(serverName, ruleName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public FirewallRuleUpdateResponse call() throws Exception + { + return update(serverName, ruleName, parameters); + } }); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServerOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServerOperationsImpl.java index bd58fd166ab2..0d7624c444cc 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServerOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServerOperationsImpl.java @@ -28,6 +28,7 @@ import com.microsoft.windowsazure.management.sql.models.ServerListResponse; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -45,7 +46,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; @@ -96,11 +96,12 @@ public class ServerOperationsImpl implements ServiceOperations changeAdministratorPasswordAsync(final String serverName, final ServerChangeAdministratorPasswordParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return changeAdministratorPassword(serverName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return changeAdministratorPassword(serverName, parameters); + } }); } @@ -202,11 +203,12 @@ public OperationResponse changeAdministratorPassword(String serverName, ServerCh @Override public Future createAsync(final ServerCreateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServerCreateResponse call() throws Exception - { - return create(parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServerCreateResponse call() throws Exception + { + return create(parameters); + } }); } @@ -332,11 +334,12 @@ public ServerCreateResponse create(ServerCreateParameters parameters) throws Par @Override public Future deleteAsync(final String serverName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(serverName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(serverName); + } }); } @@ -365,7 +368,7 @@ public OperationResponse delete(String serverName) throws IOException, ServiceEx String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/services/sqlservers/servers/" + serverName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2012-03-01"); @@ -403,11 +406,12 @@ public OperationResponse delete(String serverName) throws IOException, ServiceEx @Override public Future listAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServerListResponse call() throws Exception - { - return list(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServerListResponse call() throws Exception + { + return list(); + } }); } diff --git a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServiceObjectiveOperationsImpl.java b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServiceObjectiveOperationsImpl.java index 9570b29d5583..1a20b00f08db 100644 --- a/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServiceObjectiveOperationsImpl.java +++ b/microsoft-azure-api-management-sql/src/main/java/com/microsoft/windowsazure/management/sql/ServiceObjectiveOperationsImpl.java @@ -76,11 +76,12 @@ public class ServiceObjectiveOperationsImpl implements ServiceOperations getAsync(final String serverName, final String serviceObjectiveId) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceObjectiveGetResponse call() throws Exception - { - return get(serverName, serviceObjectiveId); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceObjectiveGetResponse call() throws Exception + { + return get(serverName, serviceObjectiveId); + } }); } @@ -342,11 +343,12 @@ public ServiceObjectiveGetResponse get(String serverName, String serviceObjectiv @Override public Future listAsync(final String serverName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ServiceObjectiveListResponse call() throws Exception - { - return list(serverName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ServiceObjectiveListResponse call() throws Exception + { + return list(serverName); + } }); } diff --git a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/AffinityGroupOperationsImpl.java b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/AffinityGroupOperationsImpl.java index 1370da4c4eda..07d2c9524ba3 100644 --- a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/AffinityGroupOperationsImpl.java +++ b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/AffinityGroupOperationsImpl.java @@ -27,6 +27,7 @@ import com.microsoft.windowsazure.management.models.AffinityGroupUpdateParameters; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -47,7 +48,6 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.codec.binary.Base64; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; @@ -81,7 +81,7 @@ public class AffinityGroupOperationsImpl implements ServiceOperations createAsync(final AffinityGroupCreateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return create(parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return create(parameters); + } }); } @@ -230,11 +231,12 @@ public OperationResponse create(AffinityGroupCreateParameters parameters) throws @Override public Future deleteAsync(final String affinityGroupName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(affinityGroupName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(affinityGroupName); + } }); } @@ -263,7 +265,7 @@ public OperationResponse delete(String affinityGroupName) throws IOException, Se String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/affinitygroups/" + affinityGroupName; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2013-03-01"); @@ -303,11 +305,12 @@ public OperationResponse delete(String affinityGroupName) throws IOException, Se @Override public Future getAsync(final String affinityGroupName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public AffinityGroupGetResponse call() throws Exception - { - return get(affinityGroupName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public AffinityGroupGetResponse call() throws Exception + { + return get(affinityGroupName); + } }); } @@ -492,11 +495,12 @@ public AffinityGroupGetResponse get(String affinityGroupName) throws IOException @Override public Future listAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public AffinityGroupListResponse call() throws Exception - { - return list(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public AffinityGroupListResponse call() throws Exception + { + return list(); + } }); } @@ -626,11 +630,12 @@ public AffinityGroupListResponse list() throws IOException, ServiceException, Pa @Override public Future updateAsync(final String affinityGroupName, final AffinityGroupUpdateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return update(affinityGroupName, parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return update(affinityGroupName, parameters); + } }); } diff --git a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/LocationOperationsImpl.java b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/LocationOperationsImpl.java index f339ec0cf31d..bfa74e291674 100644 --- a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/LocationOperationsImpl.java +++ b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/LocationOperationsImpl.java @@ -76,11 +76,12 @@ public class LocationOperationsImpl implements ServiceOperations listAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public LocationsListResponse call() throws Exception - { - return list(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public LocationsListResponse call() throws Exception + { + return list(); + } }); } diff --git a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementCertificateOperationsImpl.java b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementCertificateOperationsImpl.java index 934ab8a34454..e0ee7b3d7e00 100644 --- a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementCertificateOperationsImpl.java +++ b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementCertificateOperationsImpl.java @@ -26,6 +26,7 @@ import com.microsoft.windowsazure.management.models.ManagementCertificateListResponse; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; @@ -47,7 +48,6 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.codec.binary.Base64; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; @@ -100,11 +100,12 @@ public class ManagementCertificateOperationsImpl implements ServiceOperations createAsync(final ManagementCertificateCreateParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return create(parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return create(parameters); + } }); } @@ -220,11 +221,12 @@ public OperationResponse create(ManagementCertificateCreateParameters parameters @Override public Future deleteAsync(final String thumbprint) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return delete(thumbprint); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(thumbprint); + } }); } @@ -255,7 +257,7 @@ public OperationResponse delete(String thumbprint) throws IOException, ServiceEx String url = this.getClient().getBaseUri() + "/" + this.getClient().getCredentials().getSubscriptionId() + "/certificates/" + thumbprint; // Create HTTP transport objects - HttpDelete httpRequest = new HttpDelete(url); + CustomHttpDelete httpRequest = new CustomHttpDelete(url); // Set Headers httpRequest.setHeader("x-ms-version", "2013-03-01"); @@ -298,11 +300,12 @@ public OperationResponse delete(String thumbprint) throws IOException, ServiceEx @Override public Future getAsync(final String thumbprint) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ManagementCertificateGetResponse call() throws Exception - { - return get(thumbprint); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ManagementCertificateGetResponse call() throws Exception + { + return get(thumbprint); + } }); } @@ -425,11 +428,12 @@ public ManagementCertificateGetResponse get(String thumbprint) throws IOExceptio @Override public Future listAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public ManagementCertificateListResponse call() throws Exception - { - return list(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public ManagementCertificateListResponse call() throws Exception + { + return list(); + } }); } diff --git a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementClientImpl.java b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementClientImpl.java index a126b8081ffb..fabbcaba70ad 100644 --- a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementClientImpl.java +++ b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/ManagementClientImpl.java @@ -200,11 +200,12 @@ public ManagementClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CR @Override public Future getOperationStatusAsync(final String requestId) { - return this.getExecutorService().submit(new Callable() { @Override - public OperationStatusResponse call() throws Exception - { - return getOperationStatus(requestId); - } + return this.getExecutorService().submit(new Callable() { + @Override + public OperationStatusResponse call() throws Exception + { + return getOperationStatus(requestId); + } }); } diff --git a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/SubscriptionOperationsImpl.java b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/SubscriptionOperationsImpl.java index 117495e5b7a2..5018617ec5e8 100644 --- a/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/SubscriptionOperationsImpl.java +++ b/microsoft-azure-api-management/src/main/java/com/microsoft/windowsazure/management/SubscriptionOperationsImpl.java @@ -85,11 +85,12 @@ public class SubscriptionOperationsImpl implements ServiceOperations getAsync() { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public SubscriptionGetResponse call() throws Exception - { - return get(); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public SubscriptionGetResponse call() throws Exception + { + return get(); + } }); } @@ -317,11 +318,12 @@ public SubscriptionGetResponse get() throws IOException, ServiceException, Parse @Override public Future listOperationsAsync(final SubscriptionListOperationsParameters parameters) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public SubscriptionListOperationsResponse call() throws Exception - { - return listOperations(parameters); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public SubscriptionListOperationsResponse call() throws Exception + { + return listOperations(parameters); + } }); } @@ -557,11 +559,12 @@ public SubscriptionListOperationsResponse listOperations(SubscriptionListOperati @Override public Future registerResourceAsync(final String resourceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return registerResource(resourceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return registerResource(resourceName); + } }); } @@ -625,11 +628,12 @@ public OperationResponse registerResource(String resourceName) throws IOExceptio @Override public Future unregisterResourceAsync(final String resourceName) { - return this.getClient().getExecutorService().submit(new Callable() { @Override - public OperationResponse call() throws Exception - { - return unregisterResource(resourceName); - } + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return unregisterResource(resourceName); + } }); } diff --git a/microsoft-azure-api-parent/pom.xml b/microsoft-azure-api-parent/pom.xml index ed14caf9c79a..6c91a65cd3a4 100644 --- a/microsoft-azure-api-parent/pom.xml +++ b/microsoft-azure-api-parent/pom.xml @@ -320,6 +320,8 @@ ../microsoft-azure-api-core ../microsoft-azure-api-management ../microsoft-azure-api-management-compute + ../microsoft-azure-api-management-monitoring + ../microsoft-azure-api-management-scheduler ../microsoft-azure-api-management-serviceBus ../microsoft-azure-api-management-sql ../microsoft-azure-api-management-storage @@ -327,6 +329,7 @@ ../microsoft-azure-api-management-virtualnetwork ../microsoft-azure-api-management-website ../microsoft-azure-api-media + ../microsoft-azure-api-scheduler ../microsoft-azure-api-serviceBus ../microsoft-azure-api-serviceRuntime ../microsoft-azure-api-storage diff --git a/microsoft-azure-api-scheduler/pom.xml b/microsoft-azure-api-scheduler/pom.xml new file mode 100644 index 000000000000..bfdf2a0e004d --- /dev/null +++ b/microsoft-azure-api-scheduler/pom.xml @@ -0,0 +1,260 @@ + + + 4.0.0 + + com.microsoft.windowsazure + microsoft-azure-api-parent + 0.4.6 + ../microsoft-azure-api-parent/pom.xml + + + microsoft-azure-api-scheduler + jar + + Microsoft Windows Azure Scheduler Client API + Windows Azure Scheduler SDK Clients + https://github.com/WindowsAzure/azure-sdk-for-java + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + scm:git:https://github.com/WindowsAzure/azure-sdk-for-java + scm:git:git://github.com/WindowsAzure/azure-sdk-for-java.git + + + + UTF-8 + + + 2.1.1 + 3.0.7.RELEASE + + + + + microsoft + Microsoft + + + + + + ${project.groupId} + microsoft-azure-api-core + 0.4.6 + + + commons-logging + commons-logging + + + commons-codec + commons-codec + 1.2 + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + + com.sun.jersey + jersey-client + + + javax.xml.bind + jaxb-api + provided + + + junit + junit + test + + + org.hamcrest + hamcrest-all + test + + + org.mockito + mockito-all + test + + + javax.inject + javax.inject + + + com.sun.jersey + jersey-json + + + javax.mail + mail + + + org.bouncycastle + bcprov-jdk16 + test + + + + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + validate + + evaluate + + + legal + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.8.3 + + + serviceBus + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/serviceBus + + servicebus-atom.xsd + + com.microsoft.windowsazure.services.serviceBus.implementation + false + true + + + + management + generate-sources + + generate + + + target/generated-sources/xjc + src/main/resources/management/ + + schemas.microsoft.com.windowsazure.xsd + + com.microsoft.windowsazure.services.management.implementation + false + true + + + + + true + true + true + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.6.4 + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.4 + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright Microsoft Corporation +
* +
* 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. +
*/]]>
+
+
+ + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + true + true + true + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.8 + + src/config/checkstyle.xml + + + +
+
+
diff --git a/microsoft-azure-api-scheduler/src/config/checkstyle.xml b/microsoft-azure-api-scheduler/src/config/checkstyle.xml new file mode 100644 index 000000000000..58a40f4ac43a --- /dev/null +++ b/microsoft-azure-api-scheduler/src/config/checkstyle.xml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/Exports.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/Exports.java new file mode 100644 index 000000000000..27be9dc1d216 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/Exports.java @@ -0,0 +1,33 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.services.core.Builder; + +/** + * The Class Exports. + */ +public class Exports implements Builder.Exports { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.Builder.Exports#register(com.microsoft.windowsazure.services.core.Builder.Registry) + */ + @Override + public void register(Builder.Registry registry) { + + // provide contract implementation + registry.add(SchedulerClient.class, SchedulerClientImpl.class); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperations.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperations.java new file mode 100644 index 000000000000..92b0041fc578 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperations.java @@ -0,0 +1,200 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.scheduler.models.JobCollectionJobsUpdateStateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCollectionJobsUpdateStateResponse; +import com.microsoft.windowsazure.scheduler.models.JobCreateOrUpdateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCreateOrUpdateResponse; +import com.microsoft.windowsazure.scheduler.models.JobCreateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCreateResponse; +import com.microsoft.windowsazure.scheduler.models.JobGetHistoryParameters; +import com.microsoft.windowsazure.scheduler.models.JobGetHistoryResponse; +import com.microsoft.windowsazure.scheduler.models.JobGetResponse; +import com.microsoft.windowsazure.scheduler.models.JobListParameters; +import com.microsoft.windowsazure.scheduler.models.JobListResponse; +import com.microsoft.windowsazure.scheduler.models.JobUpdateStateParameters; +import com.microsoft.windowsazure.scheduler.models.JobUpdateStateResponse; +import com.microsoft.windowsazure.services.core.ServiceException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.util.concurrent.Future; + +public interface JobOperations +{ + /** + * If the user wants the server to create the job id then he can use a POST + * request to the jobs resource. + * + * @param parameters Parameters supplied to the Create Job operation. + * @return The Create Job operation response. + */ + JobCreateResponse create(JobCreateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException; + + /** + * If the user wants the server to create the job id then he can use a POST + * request to the jobs resource. + * + * @param parameters Parameters supplied to the Create Job operation. + * @return The Create Job operation response. + */ + Future createAsync(JobCreateParameters parameters); + + /** + * Jobs can be created or updated with a PUT operation to a job's address. + * The resource name is the ID of the job. Doing a PUT operation on a jobId + * that already exists will completely overwrite the existing job. Putting + * an existing job (replace) will reset internal execution counters. + * + * @param jobId Id of the job to create or update. + * @param parameters Parameters supplied to the job operation. + * @return The Update Job operation response. + */ + JobCreateOrUpdateResponse createOrUpdate(String jobId, JobCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException; + + /** + * Jobs can be created or updated with a PUT operation to a job's address. + * The resource name is the ID of the job. Doing a PUT operation on a jobId + * that already exists will completely overwrite the existing job. Putting + * an existing job (replace) will reset internal execution counters. + * + * @param jobId Id of the job to create or update. + * @param parameters Parameters supplied to the job operation. + * @return The Update Job operation response. + */ + Future createOrUpdateAsync(String jobId, JobCreateOrUpdateParameters parameters); + + /** + * Deletes a job. + * + * @param jobId Id of the job to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + OperationResponse delete(String jobId) throws IOException, ServiceException; + + /** + * Deletes a job. + * + * @param jobId Id of the job to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + Future deleteAsync(String jobId); + + /** + * The status of an individual job can be access by a GET call to a job's + * address, jobId. + * + * @param jobId Id of the job to get. + * @return The Get Job operation response. + */ + JobGetResponse get(String jobId) throws IOException, ServiceException, ParseException, URISyntaxException; + + /** + * The status of an individual job can be access by a GET call to a job's + * address, jobId. + * + * @param jobId Id of the job to get. + * @return The Get Job operation response. + */ + Future getAsync(String jobId); + + /** + * Job history tracks the updates and executions of a job. + * + * @param jobId Id of the job to get the history of. + * @param parameters Parameters supplied to the Get Job History operation. + * @return The Get Job History operation response. + */ + JobGetHistoryResponse getHistory(String jobId, JobGetHistoryParameters parameters) throws IOException, ServiceException, ParseException; + + /** + * Job history tracks the updates and executions of a job. + * + * @param jobId Id of the job to get the history of. + * @param parameters Parameters supplied to the Get Job History operation. + * @return The Get Job History operation response. + */ + Future getHistoryAsync(String jobId, JobGetHistoryParameters parameters); + + /** + * Fetch all jobs in a job collection. + * + * @param parameters Parameters supplied to the List Jobs operation. + * @return The List Jobs operation response. + */ + JobListResponse list(JobListParameters parameters) throws IOException, ServiceException, ParseException, URISyntaxException; + + /** + * Fetch all jobs in a job collection. + * + * @param parameters Parameters supplied to the List Jobs operation. + * @return The List Jobs operation response. + */ + Future listAsync(JobListParameters parameters); + + /** + * Job collections can be updated through a simple PATCH operation. The + * format of the request is the same as that for creating a job, though if + * a field is unspecified we will carry forward the current value. + * + * @param parameters Parameters supplied to the Update Jobs State operation. + * @return The Update Jobs State operation response. + */ + JobCollectionJobsUpdateStateResponse updateJobCollectionState(JobCollectionJobsUpdateStateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException; + + /** + * Job collections can be updated through a simple PATCH operation. The + * format of the request is the same as that for creating a job, though if + * a field is unspecified we will carry forward the current value. + * + * @param parameters Parameters supplied to the Update Jobs State operation. + * @return The Update Jobs State operation response. + */ + Future updateJobCollectionStateAsync(JobCollectionJobsUpdateStateParameters parameters); + + /** + * Jobs can be updated through a simple PATCH operation to a job's address. + * The format of the request is the same as that for creating a job, though + * if a field is unspecified we will carry forward the current value. + * + * @param jobId Id of the job to update. + * @param parameters Parameters supplied to the Update Job State operation. + * @return The Update Job State operation response. + */ + JobUpdateStateResponse updateState(String jobId, JobUpdateStateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException; + + /** + * Jobs can be updated through a simple PATCH operation to a job's address. + * The format of the request is the same as that for creating a job, though + * if a field is unspecified we will carry forward the current value. + * + * @param jobId Id of the job to update. + * @param parameters Parameters supplied to the Update Job State operation. + * @return The Update Job State operation response. + */ + Future updateStateAsync(String jobId, JobUpdateStateParameters parameters); +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperationsImpl.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperationsImpl.java new file mode 100644 index 000000000000..936a27a4db4e --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/JobOperationsImpl.java @@ -0,0 +1,4050 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.management.OperationResponse; +import com.microsoft.windowsazure.scheduler.models.Job; +import com.microsoft.windowsazure.scheduler.models.JobAction; +import com.microsoft.windowsazure.scheduler.models.JobActionType; +import com.microsoft.windowsazure.scheduler.models.JobCollectionJobsUpdateStateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCollectionJobsUpdateStateResponse; +import com.microsoft.windowsazure.scheduler.models.JobCreateOrUpdateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCreateOrUpdateResponse; +import com.microsoft.windowsazure.scheduler.models.JobCreateParameters; +import com.microsoft.windowsazure.scheduler.models.JobCreateResponse; +import com.microsoft.windowsazure.scheduler.models.JobErrorAction; +import com.microsoft.windowsazure.scheduler.models.JobGetHistoryParameters; +import com.microsoft.windowsazure.scheduler.models.JobGetHistoryResponse; +import com.microsoft.windowsazure.scheduler.models.JobGetResponse; +import com.microsoft.windowsazure.scheduler.models.JobHttpRequest; +import com.microsoft.windowsazure.scheduler.models.JobListParameters; +import com.microsoft.windowsazure.scheduler.models.JobListResponse; +import com.microsoft.windowsazure.scheduler.models.JobQueueMessage; +import com.microsoft.windowsazure.scheduler.models.JobRecurrence; +import com.microsoft.windowsazure.scheduler.models.JobRecurrenceFrequency; +import com.microsoft.windowsazure.scheduler.models.JobRecurrenceSchedule; +import com.microsoft.windowsazure.scheduler.models.JobScheduleDay; +import com.microsoft.windowsazure.scheduler.models.JobScheduleMonthlyOccurrence; +import com.microsoft.windowsazure.scheduler.models.JobState; +import com.microsoft.windowsazure.scheduler.models.JobStatus; +import com.microsoft.windowsazure.scheduler.models.JobUpdateStateParameters; +import com.microsoft.windowsazure.scheduler.models.JobUpdateStateResponse; +import com.microsoft.windowsazure.scheduler.models.RetryPolicy; +import com.microsoft.windowsazure.scheduler.models.RetryType; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceOperations; +import com.microsoft.windowsazure.services.core.TimeSpan8601Converter; +import com.microsoft.windowsazure.services.core.utils.pipeline.CustomHttpDelete; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Iterator; +import java.util.Map; +import java.util.TimeZone; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import javax.xml.datatype.Duration; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPatch; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.StringEntity; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; + +public class JobOperationsImpl implements ServiceOperations, JobOperations +{ + /** + * Initializes a new instance of the JobOperationsImpl class. + * + * @param client Reference to the service client. + */ + JobOperationsImpl(SchedulerClientImpl client) + { + this.client = client; + } + + private SchedulerClientImpl client; + + /** + * Gets a reference to the + * microsoft.windowsazure.scheduler.SchedulerClientImpl. + */ + public SchedulerClientImpl getClient() { return this.client; } + + /** + * If the user wants the server to create the job id then he can use a POST + * request to the jobs resource. + * + * @param parameters Parameters supplied to the Create Job operation. + * @return The Create Job operation response. + */ + @Override + public Future createAsync(final JobCreateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCreateResponse call() throws Exception + { + return create(parameters); + } + }); + } + + /** + * If the user wants the server to create the job id then he can use a POST + * request to the jobs resource. + * + * @param parameters Parameters supplied to the Create Job operation. + * @return The Create Job operation response. + */ + @Override + public JobCreateResponse create(JobCreateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + if (parameters.getAction() == null) + { + throw new NullPointerException("parameters.Action"); + } + if (parameters.getAction().getErrorAction() != null) + { + if (parameters.getAction().getErrorAction().getQueueMessage() != null) + { + if (parameters.getAction().getErrorAction().getQueueMessage().getMessage() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.Message"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getQueueName() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.QueueName"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getSasToken() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.SasToken"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.StorageAccountName"); + } + } + if (parameters.getAction().getErrorAction().getRequest() != null) + { + if (parameters.getAction().getErrorAction().getRequest().getMethod() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.Request.Method"); + } + if (parameters.getAction().getErrorAction().getRequest().getUri() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.Request.Uri"); + } + } + } + if (parameters.getAction().getQueueMessage() != null) + { + if (parameters.getAction().getQueueMessage().getMessage() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.Message"); + } + if (parameters.getAction().getQueueMessage().getQueueName() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.QueueName"); + } + if (parameters.getAction().getQueueMessage().getSasToken() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.SasToken"); + } + if (parameters.getAction().getQueueMessage().getStorageAccountName() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.StorageAccountName"); + } + } + if (parameters.getAction().getRequest() != null) + { + if (parameters.getAction().getRequest().getMethod() == null) + { + throw new NullPointerException("parameters.Action.Request.Method"); + } + if (parameters.getAction().getRequest().getUri() == null) + { + throw new NullPointerException("parameters.Action.Request.Uri"); + } + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs?api-version=" + "2013-10-31_Preview"; + + // Create HTTP transport objects + HttpPost httpRequest = new HttpPost(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode jobCreateParametersValue = objectMapper.createObjectNode(); + requestDoc = jobCreateParametersValue; + + if (parameters.getStartTime() != null) + { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + jobCreateParametersValue.put("startTime", simpleDateFormat.format(parameters.getStartTime().getTime())); + } + + ObjectNode actionValue = objectMapper.createObjectNode(); + jobCreateParametersValue.put("action", actionValue); + + actionValue.put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getType())); + + if (parameters.getAction().getRetryPolicy() != null) + { + ObjectNode retryPolicyValue = objectMapper.createObjectNode(); + actionValue.put("retryPolicy", retryPolicyValue); + + retryPolicyValue.put("retryType", SchedulerClientImpl.retryTypeToString(parameters.getAction().getRetryPolicy().getRetryType())); + + if (parameters.getAction().getRetryPolicy().getRetryInterval() != null) + { + retryPolicyValue.put("retryInterval", TimeSpan8601Converter.format(parameters.getAction().getRetryPolicy().getRetryInterval())); + } + + if (parameters.getAction().getRetryPolicy().getRetryCount() != null) + { + retryPolicyValue.put("retryCount", parameters.getAction().getRetryPolicy().getRetryCount()); + } + } + + if (parameters.getAction().getErrorAction() != null) + { + ObjectNode errorActionValue = objectMapper.createObjectNode(); + actionValue.put("errorAction", errorActionValue); + + errorActionValue.put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getErrorAction().getType())); + + if (parameters.getAction().getErrorAction().getRequest() != null) + { + ObjectNode requestValue = objectMapper.createObjectNode(); + errorActionValue.put("request", requestValue); + + requestValue.put("uri", parameters.getAction().getErrorAction().getRequest().getUri().toString()); + + requestValue.put("method", parameters.getAction().getErrorAction().getRequest().getMethod()); + + ObjectNode headersDictionary = objectMapper.createObjectNode(); + if (parameters.getAction().getErrorAction().getRequest().getHeaders() != null) + { + for (Map.Entry entry : parameters.getAction().getErrorAction().getRequest().getHeaders().entrySet()) + { + String headersKey = entry.getKey(); + String headersValue = entry.getValue(); + headersDictionary.put(headersKey, headersValue); + } + } + requestValue.put("headers", headersDictionary); + + if (parameters.getAction().getErrorAction().getRequest().getBody() != null) + { + requestValue.put("body", parameters.getAction().getErrorAction().getRequest().getBody()); + } + } + + if (parameters.getAction().getErrorAction().getQueueMessage() != null) + { + ObjectNode queueMessageValue = objectMapper.createObjectNode(); + errorActionValue.put("queueMessage", queueMessageValue); + + queueMessageValue.put("storageAccount", parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName()); + + queueMessageValue.put("queueName", parameters.getAction().getErrorAction().getQueueMessage().getQueueName()); + + queueMessageValue.put("sasToken", parameters.getAction().getErrorAction().getQueueMessage().getSasToken()); + + queueMessageValue.put("message", parameters.getAction().getErrorAction().getQueueMessage().getMessage()); + } + } + + if (parameters.getAction().getRequest() != null) + { + ObjectNode requestValue2 = objectMapper.createObjectNode(); + actionValue.put("request", requestValue2); + + requestValue2.put("uri", parameters.getAction().getRequest().getUri().toString()); + + requestValue2.put("method", parameters.getAction().getRequest().getMethod()); + + ObjectNode headersDictionary2 = objectMapper.createObjectNode(); + if (parameters.getAction().getRequest().getHeaders() != null) + { + for (Map.Entry entry2 : parameters.getAction().getRequest().getHeaders().entrySet()) + { + String headersKey2 = entry2.getKey(); + String headersValue2 = entry2.getValue(); + headersDictionary2.put(headersKey2, headersValue2); + } + } + requestValue2.put("headers", headersDictionary2); + + if (parameters.getAction().getRequest().getBody() != null) + { + requestValue2.put("body", parameters.getAction().getRequest().getBody()); + } + } + + if (parameters.getAction().getQueueMessage() != null) + { + ObjectNode queueMessageValue2 = objectMapper.createObjectNode(); + actionValue.put("queueMessage", queueMessageValue2); + + queueMessageValue2.put("storageAccount", parameters.getAction().getQueueMessage().getStorageAccountName()); + + queueMessageValue2.put("queueName", parameters.getAction().getQueueMessage().getQueueName()); + + queueMessageValue2.put("sasToken", parameters.getAction().getQueueMessage().getSasToken()); + + queueMessageValue2.put("message", parameters.getAction().getQueueMessage().getMessage()); + } + + if (parameters.getRecurrence() != null) + { + ObjectNode recurrenceValue = objectMapper.createObjectNode(); + jobCreateParametersValue.put("recurrence", recurrenceValue); + + recurrenceValue.put("frequency", SchedulerClientImpl.jobRecurrenceFrequencyToString(parameters.getRecurrence().getFrequency())); + + if (parameters.getRecurrence().getInterval() != null) + { + recurrenceValue.put("interval", parameters.getRecurrence().getInterval()); + } + + if (parameters.getRecurrence().getCount() != null) + { + recurrenceValue.put("count", parameters.getRecurrence().getCount()); + } + + if (parameters.getRecurrence().getEndTime() != null) + { + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + recurrenceValue.put("endTime", simpleDateFormat2.format(parameters.getRecurrence().getEndTime().getTime())); + } + + if (parameters.getRecurrence().getSchedule() != null) + { + ObjectNode scheduleValue = objectMapper.createObjectNode(); + recurrenceValue.put("schedule", scheduleValue); + + if (parameters.getRecurrence().getSchedule().getMinutes() != null) + { + ArrayNode minutesArray = objectMapper.createArrayNode(); + for (int minutesItem : parameters.getRecurrence().getSchedule().getMinutes()) + { + minutesArray.add(minutesItem); + } + scheduleValue.put("minutes", minutesArray); + } + + if (parameters.getRecurrence().getSchedule().getHours() != null) + { + ArrayNode hoursArray = objectMapper.createArrayNode(); + for (int hoursItem : parameters.getRecurrence().getSchedule().getHours()) + { + hoursArray.add(hoursItem); + } + scheduleValue.put("hours", hoursArray); + } + + if (parameters.getRecurrence().getSchedule().getDays() != null) + { + ArrayNode daysArray = objectMapper.createArrayNode(); + for (JobScheduleDay daysItem : parameters.getRecurrence().getSchedule().getDays()) + { + daysArray.add(SchedulerClientImpl.jobScheduleDayToString(daysItem)); + } + scheduleValue.put("days", daysArray); + } + + if (parameters.getRecurrence().getSchedule().getMonths() != null) + { + ArrayNode monthsArray = objectMapper.createArrayNode(); + for (int monthsItem : parameters.getRecurrence().getSchedule().getMonths()) + { + monthsArray.add(monthsItem); + } + scheduleValue.put("months", monthsArray); + } + + if (parameters.getRecurrence().getSchedule().getMonthDays() != null) + { + ArrayNode monthDaysArray = objectMapper.createArrayNode(); + for (int monthDaysItem : parameters.getRecurrence().getSchedule().getMonthDays()) + { + monthDaysArray.add(monthDaysItem); + } + scheduleValue.put("monthDays", monthDaysArray); + } + + if (parameters.getRecurrence().getSchedule().getMonthlyOccurrences() != null) + { + ArrayNode monthlyOccurrencesArray = objectMapper.createArrayNode(); + for (JobScheduleMonthlyOccurrence monthlyOccurrencesItem : parameters.getRecurrence().getSchedule().getMonthlyOccurrences()) + { + ObjectNode jobScheduleMonthlyOccurrenceValue = objectMapper.createObjectNode(); + monthlyOccurrencesArray.add(jobScheduleMonthlyOccurrenceValue); + + jobScheduleMonthlyOccurrenceValue.put("day", SchedulerClientImpl.jobScheduleDayToString(monthlyOccurrencesItem.getDay())); + + if (monthlyOccurrencesItem.getOccurrence() != null) + { + jobScheduleMonthlyOccurrenceValue.put("occurrence", monthlyOccurrencesItem.getOccurrence()); + } + } + scheduleValue.put("monthlyOccurrences", monthlyOccurrencesArray); + } + } + } + + StringWriter stringWriter = new StringWriter(); + objectMapper.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 201) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCreateResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobCreateResponse(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Job jobInstance = new Job(); + result.setJob(jobInstance); + + JsonNode idValue = responseDoc.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = responseDoc.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat3.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue2 = responseDoc.get("action"); + if (actionValue2 != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue2.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue2 = actionValue2.get("retryPolicy"); + if (retryPolicyValue2 != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue2.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue2.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue2.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue2 = actionValue2.get("errorAction"); + if (errorActionValue2 != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue2.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue3 = errorActionValue2.get("request"); + if (requestValue3 != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue3.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue3.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue3.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey3 = property.getKey(); + String headersValue3 = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey3, headersValue3); + } + } + + JsonNode bodyValue = requestValue3.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue3 = errorActionValue2.get("queueMessage"); + if (queueMessageValue3 != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue3.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue3.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue3.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue3.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue4 = actionValue2.get("request"); + if (requestValue4 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue4.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue4.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue4.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey4 = property2.getKey(); + String headersValue4 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey4, headersValue4); + } + } + + JsonNode bodyValue2 = requestValue4.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue4 = actionValue2.get("queueMessage"); + if (queueMessageValue4 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue4.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue4.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue4.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue4.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue2 = responseDoc.get("recurrence"); + if (recurrenceValue2 != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue2.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue2.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue2.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue2.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat4.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue2 = recurrenceValue2.get("schedule"); + if (scheduleValue2 != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray2 = ((ArrayNode)scheduleValue2.get("minutes")); + if (minutesArray2 != null) + { + for (JsonNode minutesValue : minutesArray2) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray2 = ((ArrayNode)scheduleValue2.get("hours")); + if (hoursArray2 != null) + { + for (JsonNode hoursValue : hoursArray2) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray2 = ((ArrayNode)scheduleValue2.get("days")); + if (daysArray2 != null) + { + for (JsonNode daysValue : daysArray2) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray2 = ((ArrayNode)scheduleValue2.get("months")); + if (monthsArray2 != null) + { + for (JsonNode monthsValue : monthsArray2) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray2 = ((ArrayNode)scheduleValue2.get("monthDays")); + if (monthDaysArray2 != null) + { + for (JsonNode monthDaysValue : monthDaysArray2) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray2 = ((ArrayNode)scheduleValue2.get("monthlyOccurrences")); + if (monthlyOccurrencesArray2 != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray2) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = responseDoc.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat5.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat6.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = responseDoc.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Jobs can be created or updated with a PUT operation to a job's address. + * The resource name is the ID of the job. Doing a PUT operation on a jobId + * that already exists will completely overwrite the existing job. Putting + * an existing job (replace) will reset internal execution counters. + * + * @param jobId Id of the job to create or update. + * @param parameters Parameters supplied to the job operation. + * @return The Update Job operation response. + */ + @Override + public Future createOrUpdateAsync(final String jobId, final JobCreateOrUpdateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCreateOrUpdateResponse call() throws Exception + { + return createOrUpdate(jobId, parameters); + } + }); + } + + /** + * Jobs can be created or updated with a PUT operation to a job's address. + * The resource name is the ID of the job. Doing a PUT operation on a jobId + * that already exists will completely overwrite the existing job. Putting + * an existing job (replace) will reset internal execution counters. + * + * @param jobId Id of the job to create or update. + * @param parameters Parameters supplied to the job operation. + * @return The Update Job operation response. + */ + @Override + public JobCreateOrUpdateResponse createOrUpdate(String jobId, JobCreateOrUpdateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (jobId == null) + { + throw new NullPointerException("jobId"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + if (parameters.getAction() == null) + { + throw new NullPointerException("parameters.Action"); + } + if (parameters.getAction().getErrorAction() != null) + { + if (parameters.getAction().getErrorAction().getQueueMessage() != null) + { + if (parameters.getAction().getErrorAction().getQueueMessage().getMessage() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.Message"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getQueueName() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.QueueName"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getSasToken() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.SasToken"); + } + if (parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.StorageAccountName"); + } + } + if (parameters.getAction().getErrorAction().getRequest() != null) + { + if (parameters.getAction().getErrorAction().getRequest().getMethod() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.Request.Method"); + } + if (parameters.getAction().getErrorAction().getRequest().getUri() == null) + { + throw new NullPointerException("parameters.Action.ErrorAction.Request.Uri"); + } + } + } + if (parameters.getAction().getQueueMessage() != null) + { + if (parameters.getAction().getQueueMessage().getMessage() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.Message"); + } + if (parameters.getAction().getQueueMessage().getQueueName() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.QueueName"); + } + if (parameters.getAction().getQueueMessage().getSasToken() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.SasToken"); + } + if (parameters.getAction().getQueueMessage().getStorageAccountName() == null) + { + throw new NullPointerException("parameters.Action.QueueMessage.StorageAccountName"); + } + } + if (parameters.getAction().getRequest() != null) + { + if (parameters.getAction().getRequest().getMethod() == null) + { + throw new NullPointerException("parameters.Action.Request.Method"); + } + if (parameters.getAction().getRequest().getUri() == null) + { + throw new NullPointerException("parameters.Action.Request.Uri"); + } + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs/" + jobId + "?api-version=" + "2013-10-31_Preview"; + + // Create HTTP transport objects + HttpPut httpRequest = new HttpPut(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode jobCreateOrUpdateParametersValue = objectMapper.createObjectNode(); + requestDoc = jobCreateOrUpdateParametersValue; + + if (parameters.getStartTime() != null) + { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + jobCreateOrUpdateParametersValue.put("startTime", simpleDateFormat.format(parameters.getStartTime().getTime())); + } + + ObjectNode actionValue = objectMapper.createObjectNode(); + jobCreateOrUpdateParametersValue.put("action", actionValue); + + actionValue.put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getType())); + + if (parameters.getAction().getRetryPolicy() != null) + { + ObjectNode retryPolicyValue = objectMapper.createObjectNode(); + actionValue.put("retryPolicy", retryPolicyValue); + + retryPolicyValue.put("retryType", SchedulerClientImpl.retryTypeToString(parameters.getAction().getRetryPolicy().getRetryType())); + + if (parameters.getAction().getRetryPolicy().getRetryInterval() != null) + { + retryPolicyValue.put("retryInterval", TimeSpan8601Converter.format(parameters.getAction().getRetryPolicy().getRetryInterval())); + } + + if (parameters.getAction().getRetryPolicy().getRetryCount() != null) + { + retryPolicyValue.put("retryCount", parameters.getAction().getRetryPolicy().getRetryCount()); + } + } + + if (parameters.getAction().getErrorAction() != null) + { + ObjectNode errorActionValue = objectMapper.createObjectNode(); + actionValue.put("errorAction", errorActionValue); + + errorActionValue.put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getErrorAction().getType())); + + if (parameters.getAction().getErrorAction().getRequest() != null) + { + ObjectNode requestValue = objectMapper.createObjectNode(); + errorActionValue.put("request", requestValue); + + requestValue.put("uri", parameters.getAction().getErrorAction().getRequest().getUri().toString()); + + requestValue.put("method", parameters.getAction().getErrorAction().getRequest().getMethod()); + + ObjectNode headersDictionary = objectMapper.createObjectNode(); + if (parameters.getAction().getErrorAction().getRequest().getHeaders() != null) + { + for (Map.Entry entry : parameters.getAction().getErrorAction().getRequest().getHeaders().entrySet()) + { + String headersKey = entry.getKey(); + String headersValue = entry.getValue(); + headersDictionary.put(headersKey, headersValue); + } + } + requestValue.put("headers", headersDictionary); + + if (parameters.getAction().getErrorAction().getRequest().getBody() != null) + { + requestValue.put("body", parameters.getAction().getErrorAction().getRequest().getBody()); + } + } + + if (parameters.getAction().getErrorAction().getQueueMessage() != null) + { + ObjectNode queueMessageValue = objectMapper.createObjectNode(); + errorActionValue.put("queueMessage", queueMessageValue); + + queueMessageValue.put("storageAccount", parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName()); + + queueMessageValue.put("queueName", parameters.getAction().getErrorAction().getQueueMessage().getQueueName()); + + queueMessageValue.put("sasToken", parameters.getAction().getErrorAction().getQueueMessage().getSasToken()); + + queueMessageValue.put("message", parameters.getAction().getErrorAction().getQueueMessage().getMessage()); + } + } + + if (parameters.getAction().getRequest() != null) + { + ObjectNode requestValue2 = objectMapper.createObjectNode(); + actionValue.put("request", requestValue2); + + requestValue2.put("uri", parameters.getAction().getRequest().getUri().toString()); + + requestValue2.put("method", parameters.getAction().getRequest().getMethod()); + + ObjectNode headersDictionary2 = objectMapper.createObjectNode(); + if (parameters.getAction().getRequest().getHeaders() != null) + { + for (Map.Entry entry2 : parameters.getAction().getRequest().getHeaders().entrySet()) + { + String headersKey2 = entry2.getKey(); + String headersValue2 = entry2.getValue(); + headersDictionary2.put(headersKey2, headersValue2); + } + } + requestValue2.put("headers", headersDictionary2); + + if (parameters.getAction().getRequest().getBody() != null) + { + requestValue2.put("body", parameters.getAction().getRequest().getBody()); + } + } + + if (parameters.getAction().getQueueMessage() != null) + { + ObjectNode queueMessageValue2 = objectMapper.createObjectNode(); + actionValue.put("queueMessage", queueMessageValue2); + + queueMessageValue2.put("storageAccount", parameters.getAction().getQueueMessage().getStorageAccountName()); + + queueMessageValue2.put("queueName", parameters.getAction().getQueueMessage().getQueueName()); + + queueMessageValue2.put("sasToken", parameters.getAction().getQueueMessage().getSasToken()); + + queueMessageValue2.put("message", parameters.getAction().getQueueMessage().getMessage()); + } + + if (parameters.getRecurrence() != null) + { + ObjectNode recurrenceValue = objectMapper.createObjectNode(); + jobCreateOrUpdateParametersValue.put("recurrence", recurrenceValue); + + recurrenceValue.put("frequency", SchedulerClientImpl.jobRecurrenceFrequencyToString(parameters.getRecurrence().getFrequency())); + + if (parameters.getRecurrence().getInterval() != null) + { + recurrenceValue.put("interval", parameters.getRecurrence().getInterval()); + } + + if (parameters.getRecurrence().getCount() != null) + { + recurrenceValue.put("count", parameters.getRecurrence().getCount()); + } + + if (parameters.getRecurrence().getEndTime() != null) + { + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); + simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); + recurrenceValue.put("endTime", simpleDateFormat2.format(parameters.getRecurrence().getEndTime().getTime())); + } + + if (parameters.getRecurrence().getSchedule() != null) + { + ObjectNode scheduleValue = objectMapper.createObjectNode(); + recurrenceValue.put("schedule", scheduleValue); + + if (parameters.getRecurrence().getSchedule().getMinutes() != null) + { + ArrayNode minutesArray = objectMapper.createArrayNode(); + for (int minutesItem : parameters.getRecurrence().getSchedule().getMinutes()) + { + minutesArray.add(minutesItem); + } + scheduleValue.put("minutes", minutesArray); + } + + if (parameters.getRecurrence().getSchedule().getHours() != null) + { + ArrayNode hoursArray = objectMapper.createArrayNode(); + for (int hoursItem : parameters.getRecurrence().getSchedule().getHours()) + { + hoursArray.add(hoursItem); + } + scheduleValue.put("hours", hoursArray); + } + + if (parameters.getRecurrence().getSchedule().getDays() != null) + { + ArrayNode daysArray = objectMapper.createArrayNode(); + for (JobScheduleDay daysItem : parameters.getRecurrence().getSchedule().getDays()) + { + daysArray.add(SchedulerClientImpl.jobScheduleDayToString(daysItem)); + } + scheduleValue.put("days", daysArray); + } + + if (parameters.getRecurrence().getSchedule().getMonths() != null) + { + ArrayNode monthsArray = objectMapper.createArrayNode(); + for (int monthsItem : parameters.getRecurrence().getSchedule().getMonths()) + { + monthsArray.add(monthsItem); + } + scheduleValue.put("months", monthsArray); + } + + if (parameters.getRecurrence().getSchedule().getMonthDays() != null) + { + ArrayNode monthDaysArray = objectMapper.createArrayNode(); + for (int monthDaysItem : parameters.getRecurrence().getSchedule().getMonthDays()) + { + monthDaysArray.add(monthDaysItem); + } + scheduleValue.put("monthDays", monthDaysArray); + } + + if (parameters.getRecurrence().getSchedule().getMonthlyOccurrences() != null) + { + ArrayNode monthlyOccurrencesArray = objectMapper.createArrayNode(); + for (JobScheduleMonthlyOccurrence monthlyOccurrencesItem : parameters.getRecurrence().getSchedule().getMonthlyOccurrences()) + { + ObjectNode jobScheduleMonthlyOccurrenceValue = objectMapper.createObjectNode(); + monthlyOccurrencesArray.add(jobScheduleMonthlyOccurrenceValue); + + jobScheduleMonthlyOccurrenceValue.put("day", SchedulerClientImpl.jobScheduleDayToString(monthlyOccurrencesItem.getDay())); + + if (monthlyOccurrencesItem.getOccurrence() != null) + { + jobScheduleMonthlyOccurrenceValue.put("occurrence", monthlyOccurrencesItem.getOccurrence()); + } + } + scheduleValue.put("monthlyOccurrences", monthlyOccurrencesArray); + } + } + } + + StringWriter stringWriter = new StringWriter(); + objectMapper.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200 && statusCode != 201) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCreateOrUpdateResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobCreateOrUpdateResponse(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Job jobInstance = new Job(); + result.setJob(jobInstance); + + JsonNode idValue = responseDoc.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = responseDoc.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat3.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue2 = responseDoc.get("action"); + if (actionValue2 != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue2.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue2 = actionValue2.get("retryPolicy"); + if (retryPolicyValue2 != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue2.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue2.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue2.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue2 = actionValue2.get("errorAction"); + if (errorActionValue2 != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue2.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue3 = errorActionValue2.get("request"); + if (requestValue3 != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue3.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue3.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue3.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey3 = property.getKey(); + String headersValue3 = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey3, headersValue3); + } + } + + JsonNode bodyValue = requestValue3.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue3 = errorActionValue2.get("queueMessage"); + if (queueMessageValue3 != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue3.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue3.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue3.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue3.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue4 = actionValue2.get("request"); + if (requestValue4 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue4.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue4.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue4.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey4 = property2.getKey(); + String headersValue4 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey4, headersValue4); + } + } + + JsonNode bodyValue2 = requestValue4.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue4 = actionValue2.get("queueMessage"); + if (queueMessageValue4 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue4.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue4.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue4.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue4.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue2 = responseDoc.get("recurrence"); + if (recurrenceValue2 != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue2.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue2.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue2.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue2.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat4.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue2 = recurrenceValue2.get("schedule"); + if (scheduleValue2 != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray2 = ((ArrayNode)scheduleValue2.get("minutes")); + if (minutesArray2 != null) + { + for (JsonNode minutesValue : minutesArray2) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray2 = ((ArrayNode)scheduleValue2.get("hours")); + if (hoursArray2 != null) + { + for (JsonNode hoursValue : hoursArray2) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray2 = ((ArrayNode)scheduleValue2.get("days")); + if (daysArray2 != null) + { + for (JsonNode daysValue : daysArray2) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray2 = ((ArrayNode)scheduleValue2.get("months")); + if (monthsArray2 != null) + { + for (JsonNode monthsValue : monthsArray2) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray2 = ((ArrayNode)scheduleValue2.get("monthDays")); + if (monthDaysArray2 != null) + { + for (JsonNode monthDaysValue : monthDaysArray2) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray2 = ((ArrayNode)scheduleValue2.get("monthlyOccurrences")); + if (monthlyOccurrencesArray2 != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray2) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = responseDoc.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat5.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat6.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = responseDoc.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Deletes a job. + * + * @param jobId Id of the job to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public Future deleteAsync(final String jobId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public OperationResponse call() throws Exception + { + return delete(jobId); + } + }); + } + + /** + * Deletes a job. + * + * @param jobId Id of the job to delete. + * @return A standard service response including an HTTP status code and + * request ID. + */ + @Override + public OperationResponse delete(String jobId) throws IOException, ServiceException + { + // Validate + if (jobId == null) + { + throw new NullPointerException("jobId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs/" + jobId + "?api-version=" + "2013-10-31_Preview"; + + // Create HTTP transport objects + CustomHttpDelete httpRequest = new CustomHttpDelete(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + OperationResponse result = null; + result = new OperationResponse(); + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * The status of an individual job can be access by a GET call to a job's + * address, jobId. + * + * @param jobId Id of the job to get. + * @return The Get Job operation response. + */ + @Override + public Future getAsync(final String jobId) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobGetResponse call() throws Exception + { + return get(jobId); + } + }); + } + + /** + * The status of an individual job can be access by a GET call to a job's + * address, jobId. + * + * @param jobId Id of the job to get. + * @return The Get Job operation response. + */ + @Override + public JobGetResponse get(String jobId) throws IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (jobId == null) + { + throw new NullPointerException("jobId"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs/" + jobId + "?api-version=" + "2013-10-31_Preview"; + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobGetResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobGetResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Job jobInstance = new Job(); + result.setJob(jobInstance); + + JsonNode idValue = responseDoc.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = responseDoc.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue = responseDoc.get("action"); + if (actionValue != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue = actionValue.get("retryPolicy"); + if (retryPolicyValue != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue = actionValue.get("errorAction"); + if (errorActionValue != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue = errorActionValue.get("request"); + if (requestValue != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey = property.getKey(); + String headersValue = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey, headersValue); + } + } + + JsonNode bodyValue = requestValue.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue = errorActionValue.get("queueMessage"); + if (queueMessageValue != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue2 = actionValue.get("request"); + if (requestValue2 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue2.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue2.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue2.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey2 = property2.getKey(); + String headersValue2 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey2, headersValue2); + } + } + + JsonNode bodyValue2 = requestValue2.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue2 = actionValue.get("queueMessage"); + if (queueMessageValue2 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue2.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue2.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue = responseDoc.get("recurrence"); + if (recurrenceValue != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue = recurrenceValue.get("schedule"); + if (scheduleValue != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray = ((ArrayNode)scheduleValue.get("minutes")); + if (minutesArray != null) + { + for (JsonNode minutesValue : minutesArray) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray = ((ArrayNode)scheduleValue.get("hours")); + if (hoursArray != null) + { + for (JsonNode hoursValue : hoursArray) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray = ((ArrayNode)scheduleValue.get("days")); + if (daysArray != null) + { + for (JsonNode daysValue : daysArray) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray = ((ArrayNode)scheduleValue.get("months")); + if (monthsArray != null) + { + for (JsonNode monthsValue : monthsArray) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray = ((ArrayNode)scheduleValue.get("monthDays")); + if (monthDaysArray != null) + { + for (JsonNode monthDaysValue : monthDaysArray) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray = ((ArrayNode)scheduleValue.get("monthlyOccurrences")); + if (monthlyOccurrencesArray != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = responseDoc.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat3.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat4.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = responseDoc.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Job history tracks the updates and executions of a job. + * + * @param jobId Id of the job to get the history of. + * @param parameters Parameters supplied to the Get Job History operation. + * @return The Get Job History operation response. + */ + @Override + public Future getHistoryAsync(final String jobId, final JobGetHistoryParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobGetHistoryResponse call() throws Exception + { + return getHistory(jobId, parameters); + } + }); + } + + /** + * Job history tracks the updates and executions of a job. + * + * @param jobId Id of the job to get the history of. + * @param parameters Parameters supplied to the Get Job History operation. + * @return The Get Job History operation response. + */ + @Override + public JobGetHistoryResponse getHistory(String jobId, JobGetHistoryParameters parameters) throws IOException, ServiceException, ParseException + { + // Validate + if (jobId == null) + { + throw new NullPointerException("jobId"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs/" + jobId + "/history?api-version=" + "2013-10-31_Preview"; + if (parameters.getState() != null) + { + url = url + "&state=" + URLEncoder.encode(SchedulerClientImpl.jobStateToString(parameters.getState())); + } + if (parameters.getSkip() != null) + { + url = url + "&$skip=" + URLEncoder.encode(Integer.toString(parameters.getSkip())); + } + if (parameters.getTop() != null) + { + url = url + "&$top=" + URLEncoder.encode(Integer.toString(parameters.getTop())); + } + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobGetHistoryResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobGetHistoryResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + ArrayNode jobHistoryArray = ((ArrayNode)responseDoc); + if (jobHistoryArray != null) + { + for (JsonNode jobHistoryValue : jobHistoryArray) + { + JobGetHistoryResponse.JobHistoryEntry jobHistoryEntryInstance = new JobGetHistoryResponse.JobHistoryEntry(); + result.getJobHistory().add(jobHistoryEntryInstance); + + JsonNode jobIdValue = jobHistoryValue.get("jobId"); + if (jobIdValue != null) + { + String jobIdInstance; + jobIdInstance = jobIdValue.getTextValue(); + jobHistoryEntryInstance.setId(jobIdInstance); + } + + JsonNode recordNumberValue = jobHistoryValue.get("recordNumber"); + if (recordNumberValue != null) + { + int recordNumberInstance; + recordNumberInstance = recordNumberValue.getIntValue(); + jobHistoryEntryInstance.setRecordNumber(recordNumberInstance); + } + + JsonNode timestampValue = jobHistoryValue.get("timestamp"); + if (timestampValue != null) + { + Calendar timestampInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(timestampValue.getTextValue())); + timestampInstance = calendar; + jobHistoryEntryInstance.setTimestamp(timestampInstance); + } + + JsonNode startTimeValue = jobHistoryValue.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar2; + jobHistoryEntryInstance.setStartTime(startTimeInstance); + } + + JsonNode endTimeValue = jobHistoryValue.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat3.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar3; + jobHistoryEntryInstance.setEndTime(endTimeInstance); + } + + JsonNode stateValue = jobHistoryValue.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobHistoryEntryInstance.setState(stateInstance); + } + + JsonNode messageValue = jobHistoryValue.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + jobHistoryEntryInstance.setMessage(messageInstance); + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Fetch all jobs in a job collection. + * + * @param parameters Parameters supplied to the List Jobs operation. + * @return The List Jobs operation response. + */ + @Override + public Future listAsync(final JobListParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobListResponse call() throws Exception + { + return list(parameters); + } + }); + } + + /** + * Fetch all jobs in a job collection. + * + * @param parameters Parameters supplied to the List Jobs operation. + * @return The List Jobs operation response. + */ + @Override + public JobListResponse list(JobListParameters parameters) throws IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs?api-version=" + "2013-10-31_Preview"; + if (parameters.getState() != null) + { + url = url + "&state=" + URLEncoder.encode(SchedulerClientImpl.jobStateToString(parameters.getState())); + } + if (parameters.getSkip() != null) + { + url = url + "&$skip=" + URLEncoder.encode(Integer.toString(parameters.getSkip())); + } + if (parameters.getTop() != null) + { + url = url + "&$top=" + URLEncoder.encode(Integer.toString(parameters.getTop())); + } + + // Create HTTP transport objects + HttpGet httpRequest = new HttpGet(url); + + // Set Headers + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobListResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobListResponse(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + ArrayNode jobsArray = ((ArrayNode)responseDoc); + if (jobsArray != null) + { + for (JsonNode jobsValue : jobsArray) + { + Job jobInstance = new Job(); + result.getJobs().add(jobInstance); + + JsonNode idValue = jobsValue.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = jobsValue.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue = jobsValue.get("action"); + if (actionValue != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue = actionValue.get("retryPolicy"); + if (retryPolicyValue != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue = actionValue.get("errorAction"); + if (errorActionValue != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue = errorActionValue.get("request"); + if (requestValue != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey = property.getKey(); + String headersValue = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey, headersValue); + } + } + + JsonNode bodyValue = requestValue.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue = errorActionValue.get("queueMessage"); + if (queueMessageValue != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue2 = actionValue.get("request"); + if (requestValue2 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue2.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue2.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue2.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey2 = property2.getKey(); + String headersValue2 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey2, headersValue2); + } + } + + JsonNode bodyValue2 = requestValue2.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue2 = actionValue.get("queueMessage"); + if (queueMessageValue2 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue2.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue2.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue = jobsValue.get("recurrence"); + if (recurrenceValue != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue = recurrenceValue.get("schedule"); + if (scheduleValue != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray = ((ArrayNode)scheduleValue.get("minutes")); + if (minutesArray != null) + { + for (JsonNode minutesValue : minutesArray) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray = ((ArrayNode)scheduleValue.get("hours")); + if (hoursArray != null) + { + for (JsonNode hoursValue : hoursArray) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray = ((ArrayNode)scheduleValue.get("days")); + if (daysArray != null) + { + for (JsonNode daysValue : daysArray) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray = ((ArrayNode)scheduleValue.get("months")); + if (monthsArray != null) + { + for (JsonNode monthsValue : monthsArray) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray = ((ArrayNode)scheduleValue.get("monthDays")); + if (monthDaysArray != null) + { + for (JsonNode monthDaysValue : monthDaysArray) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray = ((ArrayNode)scheduleValue.get("monthlyOccurrences")); + if (monthlyOccurrencesArray != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = jobsValue.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat3.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat4.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = jobsValue.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Job collections can be updated through a simple PATCH operation. The + * format of the request is the same as that for creating a job, though if + * a field is unspecified we will carry forward the current value. + * + * @param parameters Parameters supplied to the Update Jobs State operation. + * @return The Update Jobs State operation response. + */ + @Override + public Future updateJobCollectionStateAsync(final JobCollectionJobsUpdateStateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobCollectionJobsUpdateStateResponse call() throws Exception + { + return updateJobCollectionState(parameters); + } + }); + } + + /** + * Job collections can be updated through a simple PATCH operation. The + * format of the request is the same as that for creating a job, though if + * a field is unspecified we will carry forward the current value. + * + * @param parameters Parameters supplied to the Update Jobs State operation. + * @return The Update Jobs State operation response. + */ + @Override + public JobCollectionJobsUpdateStateResponse updateJobCollectionState(JobCollectionJobsUpdateStateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs"; + + // Create HTTP transport objects + HttpPatch httpRequest = new HttpPatch(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode jobCollectionJobsUpdateStateParametersValue = objectMapper.createObjectNode(); + requestDoc = jobCollectionJobsUpdateStateParametersValue; + + jobCollectionJobsUpdateStateParametersValue.put("state", SchedulerClientImpl.jobStateToString(parameters.getState())); + + StringWriter stringWriter = new StringWriter(); + objectMapper.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobCollectionJobsUpdateStateResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobCollectionJobsUpdateStateResponse(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + ArrayNode jobsArray = ((ArrayNode)responseDoc); + if (jobsArray != null) + { + for (JsonNode jobsValue : jobsArray) + { + Job jobInstance = new Job(); + result.getJobs().add(jobInstance); + + JsonNode idValue = jobsValue.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = jobsValue.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue = jobsValue.get("action"); + if (actionValue != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue = actionValue.get("retryPolicy"); + if (retryPolicyValue != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue = actionValue.get("errorAction"); + if (errorActionValue != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue = errorActionValue.get("request"); + if (requestValue != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey = property.getKey(); + String headersValue = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey, headersValue); + } + } + + JsonNode bodyValue = requestValue.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue = errorActionValue.get("queueMessage"); + if (queueMessageValue != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue2 = actionValue.get("request"); + if (requestValue2 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue2.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue2.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue2.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey2 = property2.getKey(); + String headersValue2 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey2, headersValue2); + } + } + + JsonNode bodyValue2 = requestValue2.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue2 = actionValue.get("queueMessage"); + if (queueMessageValue2 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue2.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue2.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue = jobsValue.get("recurrence"); + if (recurrenceValue != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue = recurrenceValue.get("schedule"); + if (scheduleValue != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray = ((ArrayNode)scheduleValue.get("minutes")); + if (minutesArray != null) + { + for (JsonNode minutesValue : minutesArray) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray = ((ArrayNode)scheduleValue.get("hours")); + if (hoursArray != null) + { + for (JsonNode hoursValue : hoursArray) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray = ((ArrayNode)scheduleValue.get("days")); + if (daysArray != null) + { + for (JsonNode daysValue : daysArray) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray = ((ArrayNode)scheduleValue.get("months")); + if (monthsArray != null) + { + for (JsonNode monthsValue : monthsArray) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray = ((ArrayNode)scheduleValue.get("monthDays")); + if (monthDaysArray != null) + { + for (JsonNode monthDaysValue : monthDaysArray) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray = ((ArrayNode)scheduleValue.get("monthlyOccurrences")); + if (monthlyOccurrencesArray != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = jobsValue.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat3.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat4.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = jobsValue.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } + + /** + * Jobs can be updated through a simple PATCH operation to a job's address. + * The format of the request is the same as that for creating a job, though + * if a field is unspecified we will carry forward the current value. + * + * @param jobId Id of the job to update. + * @param parameters Parameters supplied to the Update Job State operation. + * @return The Update Job State operation response. + */ + @Override + public Future updateStateAsync(final String jobId, final JobUpdateStateParameters parameters) + { + return this.getClient().getExecutorService().submit(new Callable() { + @Override + public JobUpdateStateResponse call() throws Exception + { + return updateState(jobId, parameters); + } + }); + } + + /** + * Jobs can be updated through a simple PATCH operation to a job's address. + * The format of the request is the same as that for creating a job, though + * if a field is unspecified we will carry forward the current value. + * + * @param jobId Id of the job to update. + * @param parameters Parameters supplied to the Update Job State operation. + * @return The Update Job State operation response. + */ + @Override + public JobUpdateStateResponse updateState(String jobId, JobUpdateStateParameters parameters) throws UnsupportedEncodingException, IOException, ServiceException, ParseException, URISyntaxException + { + // Validate + if (jobId == null) + { + throw new NullPointerException("jobId"); + } + if (parameters == null) + { + throw new NullPointerException("parameters"); + } + + // Tracing + + // Construct URL + String url = this.getClient().getBaseUri() + this.getClient().getCredentials().getSubscriptionId() + "/cloudservices/" + this.getClient().getCloudServiceName() + "/resources/" + "scheduler" + "/~/" + "JobCollections" + "/" + this.getClient().getJobCollectionName() + "/jobs/" + jobId + "?api-version=" + "2013-10-31_Preview"; + + // Create HTTP transport objects + HttpPatch httpRequest = new HttpPatch(url); + + // Set Headers + httpRequest.setHeader("Content-Type", "application/json"); + httpRequest.setHeader("x-ms-version", "2013-03-01"); + + // Serialize Request + String requestContent = null; + JsonNode requestDoc = null; + + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode jobUpdateStateParametersValue = objectMapper.createObjectNode(); + requestDoc = jobUpdateStateParametersValue; + + jobUpdateStateParametersValue.put("state", SchedulerClientImpl.jobStateToString(parameters.getState())); + + if (parameters.getUpdateStateReason() != null) + { + jobUpdateStateParametersValue.put("stateDetails", parameters.getUpdateStateReason()); + } + + StringWriter stringWriter = new StringWriter(); + objectMapper.writeValue(stringWriter, requestDoc); + requestContent = stringWriter.toString(); + StringEntity entity = new StringEntity(requestContent); + httpRequest.setEntity(entity); + httpRequest.setHeader("Content-Type", "application/json"); + + // Send Request + HttpResponse httpResponse = null; + httpResponse = this.getClient().getHttpClient().execute(httpRequest); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + if (statusCode != 200) + { + ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); + throw ex; + } + + // Create Result + JobUpdateStateResponse result = null; + // Deserialize Response + InputStream responseContent = httpResponse.getEntity().getContent(); + result = new JobUpdateStateResponse(); + JsonNode responseDoc = objectMapper.readTree(responseContent); + + if (responseDoc != null) + { + Job jobInstance = new Job(); + result.setJob(jobInstance); + + JsonNode idValue = responseDoc.get("id"); + if (idValue != null) + { + String idInstance; + idInstance = idValue.getTextValue(); + jobInstance.setId(idInstance); + } + + JsonNode startTimeValue = responseDoc.get("startTime"); + if (startTimeValue != null) + { + Calendar startTimeInstance; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(simpleDateFormat.parse(startTimeValue.getTextValue())); + startTimeInstance = calendar; + jobInstance.setStartTime(startTimeInstance); + } + + JsonNode actionValue = responseDoc.get("action"); + if (actionValue != null) + { + JobAction actionInstance = new JobAction(); + jobInstance.setAction(actionInstance); + + JsonNode typeValue = actionValue.get("type"); + if (typeValue != null) + { + JobActionType typeInstance; + typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); + actionInstance.setType(typeInstance); + } + + JsonNode retryPolicyValue = actionValue.get("retryPolicy"); + if (retryPolicyValue != null) + { + RetryPolicy retryPolicyInstance = new RetryPolicy(); + actionInstance.setRetryPolicy(retryPolicyInstance); + + JsonNode retryTypeValue = retryPolicyValue.get("retryType"); + if (retryTypeValue != null) + { + RetryType retryTypeInstance; + retryTypeInstance = SchedulerClientImpl.parseRetryType(retryTypeValue.getTextValue()); + retryPolicyInstance.setRetryType(retryTypeInstance); + } + + JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval"); + if (retryIntervalValue != null) + { + Duration retryIntervalInstance; + retryIntervalInstance = TimeSpan8601Converter.parse(retryIntervalValue.getTextValue()); + retryPolicyInstance.setRetryInterval(retryIntervalInstance); + } + + JsonNode retryCountValue = retryPolicyValue.get("retryCount"); + if (retryCountValue != null) + { + int retryCountInstance; + retryCountInstance = retryCountValue.getIntValue(); + retryPolicyInstance.setRetryCount(retryCountInstance); + } + } + + JsonNode errorActionValue = actionValue.get("errorAction"); + if (errorActionValue != null) + { + JobErrorAction errorActionInstance = new JobErrorAction(); + actionInstance.setErrorAction(errorActionInstance); + + JsonNode typeValue2 = errorActionValue.get("type"); + if (typeValue2 != null) + { + JobActionType typeInstance2; + typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); + errorActionInstance.setType(typeInstance2); + } + + JsonNode requestValue = errorActionValue.get("request"); + if (requestValue != null) + { + JobHttpRequest requestInstance = new JobHttpRequest(); + errorActionInstance.setRequest(requestInstance); + + JsonNode uriValue = requestValue.get("uri"); + if (uriValue != null) + { + URI uriInstance; + uriInstance = new URI(uriValue.getTextValue()); + requestInstance.setUri(uriInstance); + } + + JsonNode methodValue = requestValue.get("method"); + if (methodValue != null) + { + String methodInstance; + methodInstance = methodValue.getTextValue(); + requestInstance.setMethod(methodInstance); + } + + JsonNode headersSequenceElement = requestValue.get("headers"); + if (headersSequenceElement != null) + { + Iterator> itr = headersSequenceElement.getFields(); + while (itr.hasNext()) + { + Map.Entry property = itr.next(); + String headersKey = property.getKey(); + String headersValue = property.getValue().getTextValue(); + requestInstance.getHeaders().put(headersKey, headersValue); + } + } + + JsonNode bodyValue = requestValue.get("body"); + if (bodyValue != null) + { + String bodyInstance; + bodyInstance = bodyValue.getTextValue(); + requestInstance.setBody(bodyInstance); + } + } + + JsonNode queueMessageValue = errorActionValue.get("queueMessage"); + if (queueMessageValue != null) + { + JobQueueMessage queueMessageInstance = new JobQueueMessage(); + errorActionInstance.setQueueMessage(queueMessageInstance); + + JsonNode storageAccountValue = queueMessageValue.get("storageAccount"); + if (storageAccountValue != null) + { + String storageAccountInstance; + storageAccountInstance = storageAccountValue.getTextValue(); + queueMessageInstance.setStorageAccountName(storageAccountInstance); + } + + JsonNode queueNameValue = queueMessageValue.get("queueName"); + if (queueNameValue != null) + { + String queueNameInstance; + queueNameInstance = queueNameValue.getTextValue(); + queueMessageInstance.setQueueName(queueNameInstance); + } + + JsonNode sasTokenValue = queueMessageValue.get("sasToken"); + if (sasTokenValue != null) + { + String sasTokenInstance; + sasTokenInstance = sasTokenValue.getTextValue(); + queueMessageInstance.setSasToken(sasTokenInstance); + } + + JsonNode messageValue = queueMessageValue.get("message"); + if (messageValue != null) + { + String messageInstance; + messageInstance = messageValue.getTextValue(); + queueMessageInstance.setMessage(messageInstance); + } + } + } + + JsonNode requestValue2 = actionValue.get("request"); + if (requestValue2 != null) + { + JobHttpRequest requestInstance2 = new JobHttpRequest(); + actionInstance.setRequest(requestInstance2); + + JsonNode uriValue2 = requestValue2.get("uri"); + if (uriValue2 != null) + { + URI uriInstance2; + uriInstance2 = new URI(uriValue2.getTextValue()); + requestInstance2.setUri(uriInstance2); + } + + JsonNode methodValue2 = requestValue2.get("method"); + if (methodValue2 != null) + { + String methodInstance2; + methodInstance2 = methodValue2.getTextValue(); + requestInstance2.setMethod(methodInstance2); + } + + JsonNode headersSequenceElement2 = requestValue2.get("headers"); + if (headersSequenceElement2 != null) + { + Iterator> itr2 = headersSequenceElement2.getFields(); + while (itr2.hasNext()) + { + Map.Entry property2 = itr2.next(); + String headersKey2 = property2.getKey(); + String headersValue2 = property2.getValue().getTextValue(); + requestInstance2.getHeaders().put(headersKey2, headersValue2); + } + } + + JsonNode bodyValue2 = requestValue2.get("body"); + if (bodyValue2 != null) + { + String bodyInstance2; + bodyInstance2 = bodyValue2.getTextValue(); + requestInstance2.setBody(bodyInstance2); + } + } + + JsonNode queueMessageValue2 = actionValue.get("queueMessage"); + if (queueMessageValue2 != null) + { + JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); + actionInstance.setQueueMessage(queueMessageInstance2); + + JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount"); + if (storageAccountValue2 != null) + { + String storageAccountInstance2; + storageAccountInstance2 = storageAccountValue2.getTextValue(); + queueMessageInstance2.setStorageAccountName(storageAccountInstance2); + } + + JsonNode queueNameValue2 = queueMessageValue2.get("queueName"); + if (queueNameValue2 != null) + { + String queueNameInstance2; + queueNameInstance2 = queueNameValue2.getTextValue(); + queueMessageInstance2.setQueueName(queueNameInstance2); + } + + JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken"); + if (sasTokenValue2 != null) + { + String sasTokenInstance2; + sasTokenInstance2 = sasTokenValue2.getTextValue(); + queueMessageInstance2.setSasToken(sasTokenInstance2); + } + + JsonNode messageValue2 = queueMessageValue2.get("message"); + if (messageValue2 != null) + { + String messageInstance2; + messageInstance2 = messageValue2.getTextValue(); + queueMessageInstance2.setMessage(messageInstance2); + } + } + } + + JsonNode recurrenceValue = responseDoc.get("recurrence"); + if (recurrenceValue != null) + { + JobRecurrence recurrenceInstance = new JobRecurrence(); + jobInstance.setRecurrence(recurrenceInstance); + + JsonNode frequencyValue = recurrenceValue.get("frequency"); + if (frequencyValue != null) + { + JobRecurrenceFrequency frequencyInstance; + frequencyInstance = SchedulerClientImpl.parseJobRecurrenceFrequency(frequencyValue.getTextValue()); + recurrenceInstance.setFrequency(frequencyInstance); + } + + JsonNode intervalValue = recurrenceValue.get("interval"); + if (intervalValue != null) + { + int intervalInstance; + intervalInstance = intervalValue.getIntValue(); + recurrenceInstance.setInterval(intervalInstance); + } + + JsonNode countValue = recurrenceValue.get("count"); + if (countValue != null) + { + int countInstance; + countInstance = countValue.getIntValue(); + recurrenceInstance.setCount(countInstance); + } + + JsonNode endTimeValue = recurrenceValue.get("endTime"); + if (endTimeValue != null) + { + Calendar endTimeInstance; + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(simpleDateFormat2.parse(endTimeValue.getTextValue())); + endTimeInstance = calendar2; + recurrenceInstance.setEndTime(endTimeInstance); + } + + JsonNode scheduleValue = recurrenceValue.get("schedule"); + if (scheduleValue != null) + { + JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); + recurrenceInstance.setSchedule(scheduleInstance); + + ArrayNode minutesArray = ((ArrayNode)scheduleValue.get("minutes")); + if (minutesArray != null) + { + for (JsonNode minutesValue : minutesArray) + { + scheduleInstance.getMinutes().add(minutesValue.getIntValue()); + } + } + + ArrayNode hoursArray = ((ArrayNode)scheduleValue.get("hours")); + if (hoursArray != null) + { + for (JsonNode hoursValue : hoursArray) + { + scheduleInstance.getHours().add(hoursValue.getIntValue()); + } + } + + ArrayNode daysArray = ((ArrayNode)scheduleValue.get("days")); + if (daysArray != null) + { + for (JsonNode daysValue : daysArray) + { + scheduleInstance.getDays().add(SchedulerClientImpl.parseJobScheduleDay(daysValue.getTextValue())); + } + } + + ArrayNode monthsArray = ((ArrayNode)scheduleValue.get("months")); + if (monthsArray != null) + { + for (JsonNode monthsValue : monthsArray) + { + scheduleInstance.getMonths().add(monthsValue.getIntValue()); + } + } + + ArrayNode monthDaysArray = ((ArrayNode)scheduleValue.get("monthDays")); + if (monthDaysArray != null) + { + for (JsonNode monthDaysValue : monthDaysArray) + { + scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); + } + } + + ArrayNode monthlyOccurrencesArray = ((ArrayNode)scheduleValue.get("monthlyOccurrences")); + if (monthlyOccurrencesArray != null) + { + for (JsonNode monthlyOccurrencesValue : monthlyOccurrencesArray) + { + JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence(); + scheduleInstance.getMonthlyOccurrences().add(jobScheduleMonthlyOccurrenceInstance); + + JsonNode dayValue = monthlyOccurrencesValue.get("day"); + if (dayValue != null) + { + JobScheduleDay dayInstance; + dayInstance = SchedulerClientImpl.parseJobScheduleDay(dayValue.getTextValue()); + jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance); + } + + JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence"); + if (occurrenceValue != null) + { + int occurrenceInstance; + occurrenceInstance = occurrenceValue.getIntValue(); + jobScheduleMonthlyOccurrenceInstance.setOccurrence(occurrenceInstance); + } + } + } + } + } + + JsonNode statusValue = responseDoc.get("status"); + if (statusValue != null) + { + JobStatus statusInstance = new JobStatus(); + jobInstance.setStatus(statusInstance); + + JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime"); + if (lastExecutionTimeValue != null) + { + Calendar lastExecutionTimeInstance; + SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar3 = Calendar.getInstance(); + calendar3.setTime(simpleDateFormat3.parse(lastExecutionTimeValue.getTextValue())); + lastExecutionTimeInstance = calendar3; + statusInstance.setLastExecutionTime(lastExecutionTimeInstance); + } + + JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime"); + if (nextExecutionTimeValue != null) + { + Calendar nextExecutionTimeInstance; + SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); + Calendar calendar4 = Calendar.getInstance(); + calendar4.setTime(simpleDateFormat4.parse(nextExecutionTimeValue.getTextValue())); + nextExecutionTimeInstance = calendar4; + statusInstance.setNextExecutionTime(nextExecutionTimeInstance); + } + + JsonNode executionCountValue = statusValue.get("executionCount"); + if (executionCountValue != null) + { + int executionCountInstance; + executionCountInstance = executionCountValue.getIntValue(); + statusInstance.setExecutionCount(executionCountInstance); + } + + JsonNode failureCountValue = statusValue.get("failureCount"); + if (failureCountValue != null) + { + int failureCountInstance; + failureCountInstance = failureCountValue.getIntValue(); + statusInstance.setFailureCount(failureCountInstance); + } + + JsonNode faultedCountValue = statusValue.get("faultedCount"); + if (faultedCountValue != null) + { + int faultedCountInstance; + faultedCountInstance = faultedCountValue.getIntValue(); + statusInstance.setFaultedCount(faultedCountInstance); + } + } + + JsonNode stateValue = responseDoc.get("state"); + if (stateValue != null) + { + JobState stateInstance; + stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue()); + jobInstance.setState(stateInstance); + } + } + + result.setStatusCode(statusCode); + if (httpResponse.getHeaders("x-ms-request-id").length > 0) + { + result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); + } + + return result; + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClient.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClient.java new file mode 100644 index 000000000000..aac2e4b2f1dd --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClient.java @@ -0,0 +1,38 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import java.net.URI; + +public interface SchedulerClient +{ + URI getBaseUri(); + + String getCloudServiceName(); + + SubscriptionCloudCredentials getCredentials(); + + String getJobCollectionName(); + + JobOperations getJobs(); +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClientImpl.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClientImpl.java new file mode 100644 index 000000000000..3f0d8e43bbdd --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerClientImpl.java @@ -0,0 +1,412 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.management.ManagementConfiguration; +import com.microsoft.windowsazure.management.SubscriptionCloudCredentials; +import com.microsoft.windowsazure.scheduler.models.JobActionType; +import com.microsoft.windowsazure.scheduler.models.JobRecurrenceFrequency; +import com.microsoft.windowsazure.scheduler.models.JobScheduleDay; +import com.microsoft.windowsazure.scheduler.models.JobState; +import com.microsoft.windowsazure.scheduler.models.RetryType; +import com.microsoft.windowsazure.services.core.ServiceClient; +import java.net.URI; +import javax.inject.Inject; +import javax.inject.Named; + +public class SchedulerClientImpl extends ServiceClient implements SchedulerClient +{ + private URI baseUri; + + public URI getBaseUri() { return this.baseUri; } + + private String cloudServiceName; + + public String getCloudServiceName() { return this.cloudServiceName; } + + private SubscriptionCloudCredentials credentials; + + public SubscriptionCloudCredentials getCredentials() { return this.credentials; } + + private String jobCollectionName; + + public String getJobCollectionName() { return this.jobCollectionName; } + + private JobOperations jobs; + + public JobOperations getJobs() { return this.jobs; } + + /** + * Initializes a new instance of the SchedulerClientImpl class. + * + */ + private SchedulerClientImpl() + { + super(); + this.jobs = new JobOperationsImpl(this); + } + + /** + * Initializes a new instance of the SchedulerClientImpl class. + * + */ + public SchedulerClientImpl(SubscriptionCloudCredentials credentials, String cloudServiceName, String jobCollectionName, URI baseUri) + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + if (baseUri == null) + { + throw new NullPointerException("baseUri"); + } + this.credentials = credentials; + this.cloudServiceName = cloudServiceName; + this.jobCollectionName = jobCollectionName; + this.baseUri = baseUri; + + httpClient = credentials.initializeClient(); + } + + /** + * Initializes a new instance of the SchedulerClientImpl class. + * + */ + @Inject + public SchedulerClientImpl(@Named(ManagementConfiguration.SUBSCRIPTION_CLOUD_CREDENTIALS) SubscriptionCloudCredentials credentials, String cloudServiceName, String jobCollectionName) throws java.net.URISyntaxException + { + this(); + if (credentials == null) + { + throw new NullPointerException("credentials"); + } + if (cloudServiceName == null) + { + throw new NullPointerException("cloudServiceName"); + } + if (jobCollectionName == null) + { + throw new NullPointerException("jobCollectionName"); + } + this.credentials = credentials; + this.cloudServiceName = cloudServiceName; + this.jobCollectionName = jobCollectionName; + this.baseUri = new URI("https://management.core.windows.net/"); + + httpClient = credentials.initializeClient(); + } + + /** + * Parse enum values for type JobActionType. + * + * @param value The value to parse. + * @return The enum value. + */ + static JobActionType parseJobActionType(String value) + { + if (value == "http") + { + return JobActionType.Http; + } + if (value == "https") + { + return JobActionType.Https; + } + if (value == "storageQueue") + { + return JobActionType.StorageQueue; + } + throw new IllegalArgumentException("value"); + } + + /** + * Convert an enum of type JobActionType to a string. + * + * @param value The value to convert to a string. + * @return The enum value as a string. + */ + static String jobActionTypeToString(JobActionType value) + { + if (value == JobActionType.Http) + { + return "http"; + } + if (value == JobActionType.Https) + { + return "https"; + } + if (value == JobActionType.StorageQueue) + { + return "storageQueue"; + } + throw new IllegalArgumentException("value"); + } + + /** + * Parse enum values for type JobRecurrenceFrequency. + * + * @param value The value to parse. + * @return The enum value. + */ + static JobRecurrenceFrequency parseJobRecurrenceFrequency(String value) + { + if (value == "minute") + { + return JobRecurrenceFrequency.Minute; + } + if (value == "hour") + { + return JobRecurrenceFrequency.Hour; + } + if (value == "day") + { + return JobRecurrenceFrequency.Day; + } + if (value == "week") + { + return JobRecurrenceFrequency.Week; + } + if (value == "month") + { + return JobRecurrenceFrequency.Month; + } + if (value == "year") + { + return JobRecurrenceFrequency.Year; + } + throw new IllegalArgumentException("value"); + } + + /** + * Convert an enum of type JobRecurrenceFrequency to a string. + * + * @param value The value to convert to a string. + * @return The enum value as a string. + */ + static String jobRecurrenceFrequencyToString(JobRecurrenceFrequency value) + { + if (value == JobRecurrenceFrequency.Minute) + { + return "minute"; + } + if (value == JobRecurrenceFrequency.Hour) + { + return "hour"; + } + if (value == JobRecurrenceFrequency.Day) + { + return "day"; + } + if (value == JobRecurrenceFrequency.Week) + { + return "week"; + } + if (value == JobRecurrenceFrequency.Month) + { + return "month"; + } + if (value == JobRecurrenceFrequency.Year) + { + return "year"; + } + throw new IllegalArgumentException("value"); + } + + /** + * Parse enum values for type JobScheduleDay. + * + * @param value The value to parse. + * @return The enum value. + */ + static JobScheduleDay parseJobScheduleDay(String value) + { + if (value == "monday") + { + return JobScheduleDay.Monday; + } + if (value == "tuesday") + { + return JobScheduleDay.Tuesday; + } + if (value == "wednesday") + { + return JobScheduleDay.Wednesday; + } + if (value == "thursday") + { + return JobScheduleDay.Thursday; + } + if (value == "friday") + { + return JobScheduleDay.Friday; + } + if (value == "saturday") + { + return JobScheduleDay.Saturday; + } + if (value == "sunday") + { + return JobScheduleDay.Sunday; + } + throw new IllegalArgumentException("value"); + } + + /** + * Convert an enum of type JobScheduleDay to a string. + * + * @param value The value to convert to a string. + * @return The enum value as a string. + */ + static String jobScheduleDayToString(JobScheduleDay value) + { + if (value == JobScheduleDay.Monday) + { + return "monday"; + } + if (value == JobScheduleDay.Tuesday) + { + return "tuesday"; + } + if (value == JobScheduleDay.Wednesday) + { + return "wednesday"; + } + if (value == JobScheduleDay.Thursday) + { + return "thursday"; + } + if (value == JobScheduleDay.Friday) + { + return "friday"; + } + if (value == JobScheduleDay.Saturday) + { + return "saturday"; + } + if (value == JobScheduleDay.Sunday) + { + return "sunday"; + } + throw new IllegalArgumentException("value"); + } + + /** + * Parse enum values for type JobState. + * + * @param value The value to parse. + * @return The enum value. + */ + static JobState parseJobState(String value) + { + if (value == "enabled") + { + return JobState.Enabled; + } + if (value == "disabled") + { + return JobState.Disabled; + } + if (value == "faulted") + { + return JobState.Faulted; + } + if (value == "completed") + { + return JobState.Completed; + } + throw new IllegalArgumentException("value"); + } + + /** + * Convert an enum of type JobState to a string. + * + * @param value The value to convert to a string. + * @return The enum value as a string. + */ + static String jobStateToString(JobState value) + { + if (value == JobState.Enabled) + { + return "enabled"; + } + if (value == JobState.Disabled) + { + return "disabled"; + } + if (value == JobState.Faulted) + { + return "faulted"; + } + if (value == JobState.Completed) + { + return "completed"; + } + throw new IllegalArgumentException("value"); + } + + /** + * Parse enum values for type RetryType. + * + * @param value The value to parse. + * @return The enum value. + */ + static RetryType parseRetryType(String value) + { + if (value == "none") + { + return RetryType.None; + } + if (value == "fixed") + { + return RetryType.Fixed; + } + throw new IllegalArgumentException("value"); + } + + /** + * Convert an enum of type RetryType to a string. + * + * @param value The value to convert to a string. + * @return The enum value as a string. + */ + static String retryTypeToString(RetryType value) + { + if (value == RetryType.None) + { + return "none"; + } + if (value == RetryType.Fixed) + { + return "fixed"; + } + throw new IllegalArgumentException("value"); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerService.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerService.java new file mode 100644 index 000000000000..063de4d00443 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/SchedulerService.java @@ -0,0 +1,70 @@ +/** + * Copyright Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.scheduler; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access service functionality. + * + */ +public class SchedulerService { + + private SchedulerService() { + // class is not instantiated + } + + /** + * Creates an instance of the SchedulerClient API. + * + */ + public static SchedulerClient create() { + return Configuration.getInstance().create(SchedulerClient.class); + } + + /** + * Creates an instance of the SchedulerClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static SchedulerClient create(Configuration config) { + return config.create(SchedulerClient.class); + } + + /** + * Creates an instance of the SchedulerClient API. + * + * @param profile + * A String object that representing the profile of the service management service. + * + */ + public static SchedulerClient create(String profile) { + return Configuration.getInstance().create(profile, SchedulerClient.class); + } + + /** + * Creates an instance of the SchedulerClient API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service management. + * + */ + public static SchedulerClient create(String profile, Configuration config) { + return config.create(profile, SchedulerClient.class); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/Job.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/Job.java new file mode 100644 index 000000000000..fc7de3b71420 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/Job.java @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* A scheduler job. +*/ +public class Job +{ + private JobAction action; + + /** + * Action to invoke for the job. + */ + public JobAction getAction() { return this.action; } + + /** + * Action to invoke for the job. + */ + public void setAction(JobAction action) { this.action = action; } + + private String id; + + /** + * Job identifier. + */ + public String getId() { return this.id; } + + /** + * Job identifier. + */ + public void setId(String id) { this.id = id; } + + private JobRecurrence recurrence; + + /** + * Recurrence schedule for the job. + */ + public JobRecurrence getRecurrence() { return this.recurrence; } + + /** + * Recurrence schedule for the job. + */ + public void setRecurrence(JobRecurrence recurrence) { this.recurrence = recurrence; } + + private Calendar startTime; + + /** + * Start time for the job. Defined as ISO-8601. + */ + public Calendar getStartTime() { return this.startTime; } + + /** + * Start time for the job. Defined as ISO-8601. + */ + public void setStartTime(Calendar startTime) { this.startTime = startTime; } + + private JobState state; + + /** + * Current state of the job. + */ + public JobState getState() { return this.state; } + + /** + * Current state of the job. + */ + public void setState(JobState state) { this.state = state; } + + private JobStatus status; + + /** + * Current status of the job. + */ + public JobStatus getStatus() { return this.status; } + + /** + * Current status of the job. + */ + public void setStatus(JobStatus status) { this.status = status; } + + /** + * Initializes a new instance of the Job class. + * + */ + public Job() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobAction.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobAction.java new file mode 100644 index 000000000000..24799351d7c2 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobAction.java @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Action to invoke for the job. +*/ +public class JobAction +{ + private JobErrorAction errorAction; + + /** + * Error Action for the job. + */ + public JobErrorAction getErrorAction() { return this.errorAction; } + + /** + * Error Action for the job. + */ + public void setErrorAction(JobErrorAction errorAction) { this.errorAction = errorAction; } + + private JobQueueMessage queueMessage; + + /** + * Queue and message for a queue message action type. + */ + public JobQueueMessage getQueueMessage() { return this.queueMessage; } + + /** + * Queue and message for a queue message action type. + */ + public void setQueueMessage(JobQueueMessage queueMessage) { this.queueMessage = queueMessage; } + + private JobHttpRequest request; + + /** + * Request for a http or https action type. + */ + public JobHttpRequest getRequest() { return this.request; } + + /** + * Request for a http or https action type. + */ + public void setRequest(JobHttpRequest request) { this.request = request; } + + private RetryPolicy retryPolicy; + + /** + * Retry Policy for the job action. + */ + public RetryPolicy getRetryPolicy() { return this.retryPolicy; } + + /** + * Retry Policy for the job action. + */ + public void setRetryPolicy(RetryPolicy retryPolicy) { this.retryPolicy = retryPolicy; } + + private JobActionType type; + + /** + * Type of action. Can be one of http, https, storageQueue. + */ + public JobActionType getType() { return this.type; } + + /** + * Type of action. Can be one of http, https, storageQueue. + */ + public void setType(JobActionType type) { this.type = type; } + + /** + * Initializes a new instance of the JobAction class. + * + */ + public JobAction() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobActionType.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobActionType.java new file mode 100644 index 000000000000..4cf1b9f6cd58 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobActionType.java @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Type of action. Can be one of http, https, storageQueue. +*/ +public enum JobActionType +{ + Http, + + Https, + + StorageQueue, +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateParameters.java new file mode 100644 index 000000000000..1de58b47661d --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateParameters.java @@ -0,0 +1,43 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Parameters supplied to the Update Jobs State operation. +*/ +public class JobCollectionJobsUpdateStateParameters +{ + private JobState state; + + public JobState getState() { return this.state; } + + public void setState(JobState state) { this.state = state; } + + /** + * Initializes a new instance of the JobCollectionJobsUpdateStateParameters + * class. + * + */ + public JobCollectionJobsUpdateStateParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateResponse.java new file mode 100644 index 000000000000..d7aac2c8b6c9 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCollectionJobsUpdateStateResponse.java @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; +import java.util.ArrayList; +import java.util.Iterator; + +/** +* The Update Jobs State operation response. +*/ +public class JobCollectionJobsUpdateStateResponse extends OperationResponse implements Iterable +{ + private ArrayList jobs; + + /** + * The jobs. + */ + public ArrayList getJobs() { return this.jobs; } + + /** + * The jobs. + */ + public void setJobs(ArrayList jobs) { this.jobs = jobs; } + + /** + * Initializes a new instance of the JobCollectionJobsUpdateStateResponse + * class. + * + */ + public JobCollectionJobsUpdateStateResponse() + { + this.jobs = new ArrayList(); + } + + /** + * Gets the sequence of Jobs. + * + */ + public Iterator iterator() + { + return this.getJobs().iterator(); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateParameters.java new file mode 100644 index 000000000000..ead5dc73f03c --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateParameters.java @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* Parameters supplied to the Create or Update Job operation. +*/ +public class JobCreateOrUpdateParameters +{ + private JobAction action; + + /** + * Action to invoke for the job. + */ + public JobAction getAction() { return this.action; } + + /** + * Action to invoke for the job. + */ + public void setAction(JobAction action) { this.action = action; } + + private JobRecurrence recurrence; + + /** + * Recurrence schedule for the job. + */ + public JobRecurrence getRecurrence() { return this.recurrence; } + + /** + * Recurrence schedule for the job. + */ + public void setRecurrence(JobRecurrence recurrence) { this.recurrence = recurrence; } + + private Calendar startTime; + + /** + * Start time for the job. Defined as ISO-8601. + */ + public Calendar getStartTime() { return this.startTime; } + + /** + * Start time for the job. Defined as ISO-8601. + */ + public void setStartTime(Calendar startTime) { this.startTime = startTime; } + + /** + * Initializes a new instance of the JobCreateOrUpdateParameters class. + * + */ + public JobCreateOrUpdateParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateResponse.java new file mode 100644 index 000000000000..12a828ff5425 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateOrUpdateResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Update Job operation response. +*/ +public class JobCreateOrUpdateResponse extends OperationResponse +{ + private Job job; + + /** + * The updated job. + */ + public Job getJob() { return this.job; } + + /** + * The updated job. + */ + public void setJob(Job job) { this.job = job; } + + /** + * Initializes a new instance of the JobCreateOrUpdateResponse class. + * + */ + public JobCreateOrUpdateResponse() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateParameters.java new file mode 100644 index 000000000000..a7c16e5bb27c --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateParameters.java @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* Parameters supplied to the Create Job operation. +*/ +public class JobCreateParameters +{ + private JobAction action; + + /** + * Action to invoke for the job. + */ + public JobAction getAction() { return this.action; } + + /** + * Action to invoke for the job. + */ + public void setAction(JobAction action) { this.action = action; } + + private JobRecurrence recurrence; + + /** + * Recurrence schedule for the job. + */ + public JobRecurrence getRecurrence() { return this.recurrence; } + + /** + * Recurrence schedule for the job. + */ + public void setRecurrence(JobRecurrence recurrence) { this.recurrence = recurrence; } + + private Calendar startTime; + + /** + * Start time for the job. Defined as ISO-8601. + */ + public Calendar getStartTime() { return this.startTime; } + + /** + * Start time for the job. Defined as ISO-8601. + */ + public void setStartTime(Calendar startTime) { this.startTime = startTime; } + + /** + * Initializes a new instance of the JobCreateParameters class. + * + */ + public JobCreateParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateResponse.java new file mode 100644 index 000000000000..2d0be6629830 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobCreateResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Create Job operation response. +*/ +public class JobCreateResponse extends OperationResponse +{ + private Job job; + + /** + * The created job. + */ + public Job getJob() { return this.job; } + + /** + * The created job. + */ + public void setJob(Job job) { this.job = job; } + + /** + * Initializes a new instance of the JobCreateResponse class. + * + */ + public JobCreateResponse() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobErrorAction.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobErrorAction.java new file mode 100644 index 000000000000..62bbb47de5e5 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobErrorAction.java @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Action to invoke for the job error. +*/ +public class JobErrorAction +{ + private JobQueueMessage queueMessage; + + /** + * Queue and message for a queue message action type. + */ + public JobQueueMessage getQueueMessage() { return this.queueMessage; } + + /** + * Queue and message for a queue message action type. + */ + public void setQueueMessage(JobQueueMessage queueMessage) { this.queueMessage = queueMessage; } + + private JobHttpRequest request; + + /** + * Request for a http or https action type. + */ + public JobHttpRequest getRequest() { return this.request; } + + /** + * Request for a http or https action type. + */ + public void setRequest(JobHttpRequest request) { this.request = request; } + + private JobActionType type; + + /** + * Type of action. Can be one of http, https, storageQueue. + */ + public JobActionType getType() { return this.type; } + + /** + * Type of action. Can be one of http, https, storageQueue. + */ + public void setType(JobActionType type) { this.type = type; } + + /** + * Initializes a new instance of the JobErrorAction class. + * + */ + public JobErrorAction() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryParameters.java new file mode 100644 index 000000000000..19441efb96c7 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryParameters.java @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Parameters supplied to the Get Job History operation. +*/ +public class JobGetHistoryParameters +{ + private Integer skip; + + /** + * By default the top 100 history entries will be returned in a call to GET + * job history. A maximum of 1000 history entries can be returned in any + * call. To get history entries beyond 1000 entries use $skip. + */ + public Integer getSkip() { return this.skip; } + + /** + * By default the top 100 history entries will be returned in a call to GET + * job history. A maximum of 1000 history entries can be returned in any + * call. To get history entries beyond 1000 entries use $skip. + */ + public void setSkip(Integer skip) { this.skip = skip; } + + private JobState state; + + /** + * Filter the job history to have it only return job histories of a + * particular state. + */ + public JobState getState() { return this.state; } + + /** + * Filter the job history to have it only return job histories of a + * particular state. + */ + public void setState(JobState state) { this.state = state; } + + private Integer top; + + /** + * To receive more or less than the default number of entries in a call then + * use the $top OData operation. + */ + public Integer getTop() { return this.top; } + + /** + * To receive more or less than the default number of entries in a call then + * use the $top OData operation. + */ + public void setTop(Integer top) { this.top = top; } + + /** + * Initializes a new instance of the JobGetHistoryParameters class. + * + */ + public JobGetHistoryParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryResponse.java new file mode 100644 index 000000000000..eeea0cfeb8fb --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetHistoryResponse.java @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Iterator; + +/** +* The Get Job History operation response. +*/ +public class JobGetHistoryResponse extends OperationResponse implements Iterable +{ + private ArrayList jobHistory; + + /** + * The job history entries. + */ + public ArrayList getJobHistory() { return this.jobHistory; } + + /** + * The job history entries. + */ + public void setJobHistory(ArrayList jobHistory) { this.jobHistory = jobHistory; } + + /** + * Initializes a new instance of the JobGetHistoryResponse class. + * + */ + public JobGetHistoryResponse() + { + this.jobHistory = new ArrayList(); + } + + /** + * Gets the sequence of JobHistory. + * + */ + public Iterator iterator() + { + return this.getJobHistory().iterator(); + } + + public static class JobHistoryEntry + { + private Calendar endTime; + + public Calendar getEndTime() { return this.endTime; } + + public void setEndTime(Calendar endTime) { this.endTime = endTime; } + + private String id; + + public String getId() { return this.id; } + + public void setId(String id) { this.id = id; } + + private String message; + + public String getMessage() { return this.message; } + + public void setMessage(String message) { this.message = message; } + + private int recordNumber; + + public int getRecordNumber() { return this.recordNumber; } + + public void setRecordNumber(int recordNumber) { this.recordNumber = recordNumber; } + + private Calendar startTime; + + public Calendar getStartTime() { return this.startTime; } + + public void setStartTime(Calendar startTime) { this.startTime = startTime; } + + private JobState state; + + public JobState getState() { return this.state; } + + public void setState(JobState state) { this.state = state; } + + private Calendar timestamp; + + public Calendar getTimestamp() { return this.timestamp; } + + public void setTimestamp(Calendar timestamp) { this.timestamp = timestamp; } + + /** + * Initializes a new instance of the JobHistoryEntry class. + * + */ + public JobHistoryEntry() + { + } + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetResponse.java new file mode 100644 index 000000000000..11e0cd49dbd9 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobGetResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Get Job operation response. +*/ +public class JobGetResponse extends OperationResponse +{ + private Job job; + + /** + * The job to get. + */ + public Job getJob() { return this.job; } + + /** + * The job to get. + */ + public void setJob(Job job) { this.job = job; } + + /** + * Initializes a new instance of the JobGetResponse class. + * + */ + public JobGetResponse() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobHttpRequest.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobHttpRequest.java new file mode 100644 index 000000000000..fda7e0c466f5 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobHttpRequest.java @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.net.URI; +import java.util.HashMap; + +/** +* Request for a http or https action type. +*/ +public class JobHttpRequest +{ + private String body; + + /** + * HTTP request body. + */ + public String getBody() { return this.body; } + + /** + * HTTP request body. + */ + public void setBody(String body) { this.body = body; } + + private HashMap headers; + + /** + * pair of strings representing header name value pairs. + */ + public HashMap getHeaders() { return this.headers; } + + /** + * pair of strings representing header name value pairs. + */ + public void setHeaders(HashMap headers) { this.headers = headers; } + + private String method; + + /** + * http method e.g. GET, PUT, POST, DELETE. + */ + public String getMethod() { return this.method; } + + /** + * http method e.g. GET, PUT, POST, DELETE. + */ + public void setMethod(String method) { this.method = method; } + + private URI uri; + + /** + * uri of the endpoint to invoke. + */ + public URI getUri() { return this.uri; } + + /** + * uri of the endpoint to invoke. + */ + public void setUri(URI uri) { this.uri = uri; } + + /** + * Initializes a new instance of the JobHttpRequest class. + * + */ + public JobHttpRequest() + { + this.headers = new HashMap(); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListParameters.java new file mode 100644 index 000000000000..706dbcd24297 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListParameters.java @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Parameters supplied to the List Jobs operation. +*/ +public class JobListParameters +{ + private Integer skip; + + /** + * By default the top 1000 jobs will be returned in a call to GET jobs. A + * maximum of 1000 jobs can be returned in any call. To get jobs beyond + * 1000 entries use $skip. + */ + public Integer getSkip() { return this.skip; } + + /** + * By default the top 1000 jobs will be returned in a call to GET jobs. A + * maximum of 1000 jobs can be returned in any call. To get jobs beyond + * 1000 entries use $skip. + */ + public void setSkip(Integer skip) { this.skip = skip; } + + private JobState state; + + /** + * To filter the jobs to have it only return jobs of a particular state use + * the $filter OData operation with the ‘state’ keyword. + */ + public JobState getState() { return this.state; } + + /** + * To filter the jobs to have it only return jobs of a particular state use + * the $filter OData operation with the ‘state’ keyword. + */ + public void setState(JobState state) { this.state = state; } + + private Integer top; + + /** + * To receive more or less than the default number of jobs in a call then + * use the $top OData operation. + */ + public Integer getTop() { return this.top; } + + /** + * To receive more or less than the default number of jobs in a call then + * use the $top OData operation. + */ + public void setTop(Integer top) { this.top = top; } + + /** + * Initializes a new instance of the JobListParameters class. + * + */ + public JobListParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListResponse.java new file mode 100644 index 000000000000..4f2178febe00 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobListResponse.java @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; +import java.util.ArrayList; +import java.util.Iterator; + +/** +* The List Jobs operation response. +*/ +public class JobListResponse extends OperationResponse implements Iterable +{ + private ArrayList jobs; + + /** + * The relevant jobs. + */ + public ArrayList getJobs() { return this.jobs; } + + /** + * The relevant jobs. + */ + public void setJobs(ArrayList jobs) { this.jobs = jobs; } + + /** + * Initializes a new instance of the JobListResponse class. + * + */ + public JobListResponse() + { + this.jobs = new ArrayList(); + } + + /** + * Gets the sequence of Jobs. + * + */ + public Iterator iterator() + { + return this.getJobs().iterator(); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobQueueMessage.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobQueueMessage.java new file mode 100644 index 000000000000..0b778b4d0f45 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobQueueMessage.java @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Queue and message for a queue message action type. +*/ +public class JobQueueMessage +{ + private String message; + + /** + * Message to send to the queue. + */ + public String getMessage() { return this.message; } + + /** + * Message to send to the queue. + */ + public void setMessage(String message) { this.message = message; } + + private String queueName; + + /** + * Name of the queue to send to. + */ + public String getQueueName() { return this.queueName; } + + /** + * Name of the queue to send to. + */ + public void setQueueName(String queueName) { this.queueName = queueName; } + + private String sasToken; + + /** + * SAS key for the storage account to send message to the queue. + */ + public String getSasToken() { return this.sasToken; } + + /** + * SAS key for the storage account to send message to the queue. + */ + public void setSasToken(String sasToken) { this.sasToken = sasToken; } + + private String storageAccountName; + + /** + * Name of the storage account for the queue. + */ + public String getStorageAccountName() { return this.storageAccountName; } + + /** + * Name of the storage account for the queue. + */ + public void setStorageAccountName(String storageAccountName) { this.storageAccountName = storageAccountName; } + + /** + * Initializes a new instance of the JobQueueMessage class. + * + */ + public JobQueueMessage() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrence.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrence.java new file mode 100644 index 000000000000..bd7293ca7ad4 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrence.java @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* Recurrence schedule for the job. +*/ +public class JobRecurrence +{ + private Integer count; + + /** + * Count of occurrences that will execute. Optional. Default will recur + * infinitely + */ + public Integer getCount() { return this.count; } + + /** + * Count of occurrences that will execute. Optional. Default will recur + * infinitely + */ + public void setCount(Integer count) { this.count = count; } + + private Calendar endTime; + + /** + * Time in ISO-8601 format after which no more occurrences will execute. + */ + public Calendar getEndTime() { return this.endTime; } + + /** + * Time in ISO-8601 format after which no more occurrences will execute. + */ + public void setEndTime(Calendar endTime) { this.endTime = endTime; } + + private JobRecurrenceFrequency frequency; + + /** + * The frequency of recurrence. + */ + public JobRecurrenceFrequency getFrequency() { return this.frequency; } + + /** + * The frequency of recurrence. + */ + public void setFrequency(JobRecurrenceFrequency frequency) { this.frequency = frequency; } + + private Integer interval; + + /** + * Interval of the recurrence at the given frequency. + */ + public Integer getInterval() { return this.interval; } + + /** + * Interval of the recurrence at the given frequency. + */ + public void setInterval(Integer interval) { this.interval = interval; } + + private JobRecurrenceSchedule schedule; + + /** + * Recurrence schedule for the job. + */ + public JobRecurrenceSchedule getSchedule() { return this.schedule; } + + /** + * Recurrence schedule for the job. + */ + public void setSchedule(JobRecurrenceSchedule schedule) { this.schedule = schedule; } + + /** + * Initializes a new instance of the JobRecurrence class. + * + */ + public JobRecurrence() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceFrequency.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceFrequency.java new file mode 100644 index 000000000000..3ca0bbf8767d --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceFrequency.java @@ -0,0 +1,41 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* The frequency of recurrence. Must be one of: minute, hour, day, week, month, +* year. +*/ +public enum JobRecurrenceFrequency +{ + Minute, + + Hour, + + Day, + + Week, + + Month, + + Year, +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceSchedule.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceSchedule.java new file mode 100644 index 000000000000..e61a48350ba9 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobRecurrenceSchedule.java @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.ArrayList; + +/** +* Recurrence schedule for the job. +*/ +public class JobRecurrenceSchedule +{ + private ArrayList days; + + /** + * Days of the week that the job should execute on. + */ + public ArrayList getDays() { return this.days; } + + /** + * Days of the week that the job should execute on. + */ + public void setDays(ArrayList days) { this.days = days; } + + private ArrayList hours; + + /** + * Hours of the day that the job should execute at. + */ + public ArrayList getHours() { return this.hours; } + + /** + * Hours of the day that the job should execute at. + */ + public void setHours(ArrayList hours) { this.hours = hours; } + + private ArrayList minutes; + + /** + * Minutes of the hour that the job should execute at. + */ + public ArrayList getMinutes() { return this.minutes; } + + /** + * Minutes of the hour that the job should execute at. + */ + public void setMinutes(ArrayList minutes) { this.minutes = minutes; } + + private ArrayList monthDays; + + /** + * Days of the month that the job should execute on. Must be between 1 and + * 31. + */ + public ArrayList getMonthDays() { return this.monthDays; } + + /** + * Days of the month that the job should execute on. Must be between 1 and + * 31. + */ + public void setMonthDays(ArrayList monthDays) { this.monthDays = monthDays; } + + private ArrayList monthlyOccurrences; + + /** + * Occurrences of days within a month. + */ + public ArrayList getMonthlyOccurrences() { return this.monthlyOccurrences; } + + /** + * Occurrences of days within a month. + */ + public void setMonthlyOccurrences(ArrayList monthlyOccurrences) { this.monthlyOccurrences = monthlyOccurrences; } + + private ArrayList months; + + /** + * Months that the job should execute in. Must be between 1 and 12. + */ + public ArrayList getMonths() { return this.months; } + + /** + * Months that the job should execute in. Must be between 1 and 12. + */ + public void setMonths(ArrayList months) { this.months = months; } + + /** + * Initializes a new instance of the JobRecurrenceSchedule class. + * + */ + public JobRecurrenceSchedule() + { + this.days = new ArrayList(); + this.hours = new ArrayList(); + this.minutes = new ArrayList(); + this.monthDays = new ArrayList(); + this.monthlyOccurrences = new ArrayList(); + this.months = new ArrayList(); + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleDay.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleDay.java new file mode 100644 index 000000000000..02175288fca2 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleDay.java @@ -0,0 +1,42 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. +*/ +public enum JobScheduleDay +{ + Monday, + + Tuesday, + + Wednesday, + + Thursday, + + Friday, + + Saturday, + + Sunday, +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleMonthlyOccurrence.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleMonthlyOccurrence.java new file mode 100644 index 000000000000..4c3b066f67a8 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobScheduleMonthlyOccurrence.java @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Occurrences of days within a month. +*/ +public class JobScheduleMonthlyOccurrence +{ + private JobScheduleDay day; + + /** + * Day of the occurrence. Must be one of monday, tuesday, wednesday, + * thursday, friday, saturday, sunday. + */ + public JobScheduleDay getDay() { return this.day; } + + /** + * Day of the occurrence. Must be one of monday, tuesday, wednesday, + * thursday, friday, saturday, sunday. + */ + public void setDay(JobScheduleDay day) { this.day = day; } + + private Integer occurrence; + + /** + * Occurrence of the day within the month. Must be between -31 and 31. + */ + public Integer getOccurrence() { return this.occurrence; } + + /** + * Occurrence of the day within the month. Must be between -31 and 31. + */ + public void setOccurrence(Integer occurrence) { this.occurrence = occurrence; } + + /** + * Initializes a new instance of the JobScheduleMonthlyOccurrence class. + * + */ + public JobScheduleMonthlyOccurrence() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobState.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobState.java new file mode 100644 index 000000000000..946229c0de08 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobState.java @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +public enum JobState +{ + Enabled, + + Disabled, + + Faulted, + + Completed, +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobStatus.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobStatus.java new file mode 100644 index 000000000000..a7a5320a0c39 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobStatus.java @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* Current status of the job. +*/ +public class JobStatus +{ + private int executionCount; + + /** + * Number of times this job has executed. + */ + public int getExecutionCount() { return this.executionCount; } + + /** + * Number of times this job has executed. + */ + public void setExecutionCount(int executionCount) { this.executionCount = executionCount; } + + private int failureCount; + + /** + * Number of times this job has failed. + */ + public int getFailureCount() { return this.failureCount; } + + /** + * Number of times this job has failed. + */ + public void setFailureCount(int failureCount) { this.failureCount = failureCount; } + + private int faultedCount; + + /** + * Number of faulted occurrences (occurrences that were retried and failed + * as many times as the retry policy states). + */ + public int getFaultedCount() { return this.faultedCount; } + + /** + * Number of faulted occurrences (occurrences that were retried and failed + * as many times as the retry policy states). + */ + public void setFaultedCount(int faultedCount) { this.faultedCount = faultedCount; } + + private Calendar lastExecutionTime; + + /** + * Time the last occurrence executed in ISO-8601 format. Could be empty if + * job has not run yet. + */ + public Calendar getLastExecutionTime() { return this.lastExecutionTime; } + + /** + * Time the last occurrence executed in ISO-8601 format. Could be empty if + * job has not run yet. + */ + public void setLastExecutionTime(Calendar lastExecutionTime) { this.lastExecutionTime = lastExecutionTime; } + + private Calendar nextExecutionTime; + + /** + * Time of the next occurrence in ISO-8601 format. Could be empty if the job + * is completed. + */ + public Calendar getNextExecutionTime() { return this.nextExecutionTime; } + + /** + * Time of the next occurrence in ISO-8601 format. Could be empty if the job + * is completed. + */ + public void setNextExecutionTime(Calendar nextExecutionTime) { this.nextExecutionTime = nextExecutionTime; } + + /** + * Initializes a new instance of the JobStatus class. + * + */ + public JobStatus() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateParameters.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateParameters.java new file mode 100644 index 000000000000..991c878bfdfb --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateParameters.java @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* Parameters supplied to the Update Job State operation. +*/ +public class JobUpdateStateParameters +{ + private JobState state; + + public JobState getState() { return this.state; } + + public void setState(JobState state) { this.state = state; } + + private String updateStateReason; + + public String getUpdateStateReason() { return this.updateStateReason; } + + public void setUpdateStateReason(String updateStateReason) { this.updateStateReason = updateStateReason; } + + /** + * Initializes a new instance of the JobUpdateStateParameters class. + * + */ + public JobUpdateStateParameters() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateResponse.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateResponse.java new file mode 100644 index 000000000000..8a8f41e918ec --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/JobUpdateStateResponse.java @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import com.microsoft.windowsazure.management.OperationResponse; + +/** +* The Update Job State operation response. +*/ +public class JobUpdateStateResponse extends OperationResponse +{ + private Job job; + + /** + * The updated job. + */ + public Job getJob() { return this.job; } + + /** + * The updated job. + */ + public void setJob(Job job) { this.job = job; } + + /** + * Initializes a new instance of the JobUpdateStateResponse class. + * + */ + public JobUpdateStateResponse() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryPolicy.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryPolicy.java new file mode 100644 index 000000000000..dbaa4b152d05 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryPolicy.java @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +import java.util.Calendar; + +/** +* Retry Policy for the job action. +*/ +public class RetryPolicy +{ + private Integer retryCount; + + /** + * Number of times a retry should be attempted. + */ + public Integer getRetryCount() { return this.retryCount; } + + /** + * Number of times a retry should be attempted. + */ + public void setRetryCount(Integer retryCount) { this.retryCount = retryCount; } + + private Calendar retryInterval; + + /** + * The interval between retries. + */ + public Calendar getRetryInterval() { return this.retryInterval; } + + /** + * The interval between retries. + */ + public void setRetryInterval(Calendar retryInterval) { this.retryInterval = retryInterval; } + + private RetryType retryType; + + /** + * The Retry Type of the Retry Policy. Can be either Fixed or None. + */ + public RetryType getRetryType() { return this.retryType; } + + /** + * The Retry Type of the Retry Policy. Can be either Fixed or None. + */ + public void setRetryType(RetryType retryType) { this.retryType = retryType; } + + /** + * Initializes a new instance of the RetryPolicy class. + * + */ + public RetryPolicy() + { + } +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryType.java b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryType.java new file mode 100644 index 000000000000..cca93221eecf --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/models/RetryType.java @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft and contributors. 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. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +package com.microsoft.windowsazure.scheduler.models; + +/** +* The type of Retry Policy +*/ +public enum RetryType +{ + None, + + Fixed, +} diff --git a/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/package.html b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/package.html new file mode 100644 index 000000000000..e8dfd96862b7 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/java/com/microsoft/windowsazure/scheduler/package.html @@ -0,0 +1,6 @@ + + +This package contains the service management class, + interface, and associated configuration and utility classes. + + diff --git a/microsoft-azure-api-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports new file mode 100644 index 000000000000..f6798f9934f9 --- /dev/null +++ b/microsoft-azure-api-scheduler/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -0,0 +1 @@ +com.microsoft.windowsazure.scheduler.Exports