/// <summary> /// Returns the ACL entry for the specified entity on the specified bucket. /// Documentation https://developers.google.com/storage/v1beta2/reference/bucketAccessControls/get /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of a bucket.</param> /// <param name="entity">The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.</param> /// <returns>BucketAccessControlResponse</returns> public static BucketAccessControl Get(storageService service, string bucket, string entity) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (bucket == null) { throw new ArgumentNullException(bucket); } if (entity == null) { throw new ArgumentNullException(entity); } // Make the request. return(service.BucketAccessControls.Get(bucket, entity).Execute()); } catch (Exception ex) { throw new Exception("Request BucketAccessControls.Get failed.", ex); } }
/// <summary> /// Retrieves default object ACL entries on the specified bucket. /// Documentation https://developers.google.com/storage/v1/reference/defaultObjectAccessControls/list /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of a bucket.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ObjectAccessControlsResponse</returns> public static ObjectAccessControls List(storageService service, string bucket, DefaultObjectAccessControlsListOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (bucket == null) { throw new ArgumentNullException(bucket); } // Building the initial request. var request = service.DefaultObjectAccessControls.List(bucket); // Applying optional parameters to the request. request = (DefaultObjectAccessControlsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request DefaultObjectAccessControls.List failed.", ex); } }
/// <summary> /// Updates a default object ACL entry on the specified bucket. /// Documentation https://developers.google.com/storage/v1/reference/defaultObjectAccessControls/update /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of a bucket.</param> /// <param name="entity">The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.</param> /// <param name="body">A valid storage v1 body.</param> /// <returns>ObjectAccessControlResponse</returns> public static ObjectAccessControl Update(storageService service, string bucket, string entity, ObjectAccessControl body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (bucket == null) { throw new ArgumentNullException(bucket); } if (entity == null) { throw new ArgumentNullException(entity); } // Make the request. return(service.DefaultObjectAccessControls.Update(body, bucket, entity).Execute()); } catch (Exception ex) { throw new Exception("Request DefaultObjectAccessControls.Update failed.", ex); } }
/// <summary> /// Deletes data blobs and associated metadata. /// Documentation https://developers.google.com/storage/v1beta1/reference/objects/delete /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of the bucket in which the object resides.</param> /// <param name="object">Name of the object.</param> public static void Delete(storageService service, string bucket, string object) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (bucket == null) { throw new ArgumentNullException(bucket); } if (object == null) { throw new ArgumentNullException(object); } // Make the request. return(service.Objects.Delete(bucket, object).Execute()); } catch (Exception ex) { throw new Exception("Request Objects.Delete failed.", ex); } }
/// <summary> /// Returns metadata for the specified bucket. /// Documentation https://developers.google.com/storage/v1beta1/reference/buckets/get /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of a bucket.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>BucketResponse</returns> public static Bucket Get(storageService service, string bucket, BucketsGetOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (bucket == null) { throw new ArgumentNullException(bucket); } // Building the initial request. var request = service.Buckets.Get(bucket); // Applying optional parameters to the request. request = (BucketsResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Buckets.Get failed.", ex); } }
/// <summary> /// Copies an object to a destination in the same location. Optionally overrides metadata. /// Documentation https://developers.google.com/storage/v1beta2/reference/objects/copy /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="sourceBucket">Name of the bucket in which to find the source object.</param> /// <param name="sourceObject">Name of the source object.</param> /// <param name="destinationBucket">Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.</param> /// <param name="destinationObject">Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.</param> /// <param name="body">A valid storage v1beta2 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ObjectResponse</returns> public static Object Copy(storageService service, string sourceBucket, string sourceObject, string destinationBucket, string destinationObject, Object body, ObjectsCopyOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (sourceBucket == null) { throw new ArgumentNullException(sourceBucket); } if (sourceObject == null) { throw new ArgumentNullException(sourceObject); } if (destinationBucket == null) { throw new ArgumentNullException(destinationBucket); } if (destinationObject == null) { throw new ArgumentNullException(destinationObject); } // Building the initial request. var request = service.Objects.Copy(body, sourceBucket, sourceObject, destinationBucket, destinationObject); // Applying optional parameters to the request. request = (ObjectsResource.CopyRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Objects.Copy failed.", ex); } }
/// <summary> /// Stop watching resources through this channel /// Documentation https://developers.google.com/storage/v1/reference/channels/stop /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="body">A valid storage v1 body.</param> public static void Stop(storageService service, Channel body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Channels.Stop(body).Execute()); } catch (Exception ex) { throw new Exception("Request Channels.Stop failed.", ex); } }
/// <summary> /// Deletes the ACL entry for the specified entity on the specified object. /// Documentation https://developers.google.com/storage/v1beta1/reference/objectAccessControls/delete /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of a bucket.</param> /// <param name="object">Name of the object.</param> /// <param name="entity">The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.</param> public static void Delete(storageService service, string bucket, string object, string entity)
/// <summary> /// Retrieves objects or their associated metadata. /// Documentation https://developers.google.com/storage/v1beta1/reference/objects/get /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated storage service.</param> /// <param name="bucket">Name of the bucket in which the object resides.</param> /// <param name="object">Name of the object.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ObjectResponse</returns> public static Object Get(storageService service, string bucket, string object, ObjectsGetOptionalParms optional = null)