|
24 | 24 | import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation;
|
25 | 25 | import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation;
|
26 | 26 | import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation;
|
| 27 | +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase; |
27 | 28 | import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase;
|
| 29 | +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; |
28 | 30 | import com.microsoft.windowsazure.services.media.implementation.content.AssetDeliveryPolicyRestType;
|
| 31 | +import com.microsoft.windowsazure.services.media.models.ContentKeyAuthorizationPolicyOption.Updater; |
29 | 32 | import com.sun.jersey.api.client.GenericType;
|
30 | 33 |
|
31 | 34 | /**
|
@@ -169,4 +172,66 @@ public static DefaultListOperation<AssetDeliveryPolicyInfo> list(LinkInfo<AssetD
|
169 | 172 | public static EntityDeleteOperation delete(String assetDeliveryPolicyId) {
|
170 | 173 | return new DefaultDeleteOperation(ENTITY_SET, assetDeliveryPolicyId);
|
171 | 174 | }
|
| 175 | + |
| 176 | + public static Updater update(String assetDeliveryPolicyId) { |
| 177 | + return new Updater(assetDeliveryPolicyId); |
| 178 | + } |
| 179 | + |
| 180 | + public static class Updater extends EntityOperationBase implements EntityUpdateOperation { |
| 181 | + |
| 182 | + private EnumSet<AssetDeliveryProtocol> assetDeliveryProtocol; |
| 183 | + private AssetDeliveryPolicyType assetDeliveryPolicyType; |
| 184 | + private Map<AssetDeliveryPolicyConfigurationKey, String> assetDeliveryConfiguration; |
| 185 | + |
| 186 | + protected Updater(String assetDeliveryPolicyId) { |
| 187 | + super(new EntityOperationBase.EntityIdUriBuilder(ENTITY_SET, assetDeliveryPolicyId)); |
| 188 | + |
| 189 | + } |
| 190 | + |
| 191 | + @Override |
| 192 | + public Object getRequestContents() { |
| 193 | + return new AssetDeliveryPolicyRestType() |
| 194 | + .setAssetDeliveryConfiguration(assetDeliveryConfiguration) |
| 195 | + .setAssetDeliveryPolicyType(assetDeliveryPolicyType.getCode()) |
| 196 | + .setAssetDeliveryProtocol(AssetDeliveryProtocol.bitsFromProtocols(assetDeliveryProtocol)); |
| 197 | + } |
| 198 | + |
| 199 | + /** |
| 200 | + * Set the protocol of the Asset Delivery Policy to be created. |
| 201 | + * |
| 202 | + * @param assetDeliveryProtocol |
| 203 | + * The protocol |
| 204 | + * @return The creator object (for call chaining) |
| 205 | + */ |
| 206 | + public Updater setAssetDeliveryProtocol(EnumSet<AssetDeliveryProtocol> assetDeliveryProtocol) { |
| 207 | + this.assetDeliveryProtocol = assetDeliveryProtocol; |
| 208 | + return this; |
| 209 | + } |
| 210 | + |
| 211 | + /** |
| 212 | + * Set the type of the Asset Delivery Policy to be created. |
| 213 | + * |
| 214 | + * @param assetDeliveryPolicyType |
| 215 | + * The type |
| 216 | + * @return The creator object (for call chaining) |
| 217 | + */ |
| 218 | + public Updater setAssetDeliveryPolicyType(AssetDeliveryPolicyType assetDeliveryPolicyType) { |
| 219 | + this.assetDeliveryPolicyType = assetDeliveryPolicyType; |
| 220 | + return this; |
| 221 | + } |
| 222 | + |
| 223 | + /** |
| 224 | + * Set the configuration of the Asset Delivery Policy to be created. |
| 225 | + * |
| 226 | + * @param assetDeliveryPolicyConfiguration |
| 227 | + * The configuration |
| 228 | + * @return The creator object (for call chaining) |
| 229 | + */ |
| 230 | + public Updater setAssetDeliveryConfiguration( |
| 231 | + Map<AssetDeliveryPolicyConfigurationKey, String> assetDeliveryPolicyConfiguration) { |
| 232 | + this.assetDeliveryConfiguration = assetDeliveryPolicyConfiguration; |
| 233 | + return this; |
| 234 | + } |
| 235 | + |
| 236 | + } |
172 | 237 | }
|
0 commit comments