Package com.google.api.services.storage

Examples of com.google.api.services.storage.Storage


  @Test
  public void testDescribeRequestAndResponseForApiClient() throws Exception {
    HttpRequestInitializer initializer = mock(HttpRequestInitializer.class);
    NetHttpTransport transport = new NetHttpTransport();
    Storage storage = new Storage.Builder(transport, new JacksonFactory(), initializer)
        .setApplicationName("bla").build();
    HttpRequest request = storage.objects().delete("b", "o").buildHttpRequest();
    request.getHeaders().clear();
    request.getHeaders().put("k1", "v1");
    request.getHeaders().put("k2", "v2");
    HttpResponseException exception = null;
    try {
View Full Code Here


                    .setJsonFactory(JSON_FACTORY)
                    .setServiceAccountId(gccCredential.getServiceAccountId())
                    .setServiceAccountScopes(SCOPES)
                    .setServiceAccountPrivateKey(kp.getPrivate())
                    .build();
            Storage storage = new Storage.Builder(
                    httpTransport, JSON_FACTORY, null).setApplicationName(stack.getName())
                    .setHttpRequestInitializer(credential)
                    .build();
            return storage;
        } catch (GeneralSecurityException e) {
View Full Code Here

    @Override
    public void setupProvisioning(Stack stack) {
        MDCBuilder.buildMdcContext(stack);
        try {
            Storage storage = gccStackUtil.buildStorage((GccCredential) stack.getCredential(), stack);
            Compute compute = gccStackUtil.buildCompute((GccCredential) stack.getCredential(), stack.getName());
            GccTemplate template = (GccTemplate) stack.getTemplate();
            GccCredential credential = (GccCredential) stack.getCredential();
            ImageList list = compute.images().list(credential.getProjectId()).execute();
            Long time = new Date().getTime();
            if (!containsSpecificImage(list)) {
                try {
                    Bucket bucket = new Bucket();
                    bucket.setName(credential.getProjectId() + time);
                    bucket.setStorageClass("STANDARD");
                    Storage.Buckets.Insert ins = storage.buckets().insert(credential.getProjectId(), bucket);
                    ins.execute();
                } catch (GoogleJsonResponseException ex) {
                    if (ex.getStatusCode() != CONFLICT) {
                        throw ex;
                    }
                }
                Storage.Objects.Copy copy = storage.objects().copy(BUCKET_NAME, TAR_NAME, credential.getProjectId() + time, TAR_NAME,
                        new StorageObject());
                copy.execute();

                Image image = new Image();
                image.setName(GccImageType.DEBIAN_HACK.getImageName());
View Full Code Here

TOP

Related Classes of com.google.api.services.storage.Storage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.