| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.atmos.options; |
| 20 | |
| 21 | import org.jclouds.http.options.BaseHttpRequestOptions; |
| 22 | |
| 23 | /** |
| 24 | * Contains options supported in the REST API for the PUT operations. |
| 25 | * <p/> |
| 26 | * <h2> |
| 27 | * Usage</h2> The recommended way to instantiate a PutOptions object is to statically import |
| 28 | * PutOptions.Builder.* and invoke a static creation method followed by an instance mutator (if |
| 29 | * needed): |
| 30 | * <p/> |
| 31 | * <code> |
| 32 | * import org.jclouds.atmos.options.PutOptions.Builder.* |
| 33 | * import org.jclouds.atmos.AtmosClient; |
| 34 | * |
| 35 | * AtmosClient connection = // get connection |
| 36 | * connection.createDirectory("directory", publicRead()); |
| 37 | * <code> |
| 38 | * |
| 39 | * @author Adrian Cole |
| 40 | * |
| 41 | */ |
| 42 | public class PutOptions extends BaseHttpRequestOptions { |
| 43 | public static final PutOptions NONE = new PutOptions(); |
| 44 | |
| 45 | /** |
| 46 | * Add public access to all users |
| 47 | * |
| 48 | */ |
| 49 | public PutOptions publicRead() { |
| 50 | this.replaceHeader("x-emc-useracl", "root=FULL_CONTROL"); |
| 51 | this.replaceHeader("x-emc-groupacl", "other=READ"); |
| 52 | return this; |
| 53 | } |
| 54 | |
| 55 | public static class Builder { |
| 56 | |
| 57 | /** |
| 58 | * @see PutOptions#publicRead |
| 59 | */ |
| 60 | public static PutOptions publicRead() { |
| 61 | PutOptions options = new PutOptions(); |
| 62 | return options.publicRead(); |
| 63 | } |
| 64 | } |
| 65 | } |