Example #1
0
// Delete deletes the interface with interfaceID attached to the instance with
// instanceID.
func Delete(c *gophercloud.ServiceClient, instanceID, interfaceID string) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(deleteURL(c, instanceID, interfaceID), &gophercloud.RequestOpts{
		OkCodes: []int{200, 204},
	})
	return res
}
Example #2
0
// Delete implements image delete request
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
	var res DeleteResult
	_, res.Err = client.Delete(deleteURL(client, id), &gophercloud.RequestOpts{
		OkCodes: []int{204},
	})
	return res
}
Example #3
0
// Delete is the operation responsible for deleting the SSL Termination
// configuration for a load balancer.
func Delete(c *gophercloud.ServiceClient, lbID int) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(rootURL(c, lbID), &gophercloud.RequestOpts{
		OkCodes: []int{200},
	})
	return res
}
Example #4
0
// DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) DeleteMetadatumResult {
	var res DeleteMetadatumResult
	_, res.Err = client.Delete(metadatumURL(client, id, key), &gophercloud.RequestOpts{
		JSONResponse: &res.Body,
	})
	return res
}
Example #5
0
// DeleteErrorPage will delete the current error page for the load balancer.
func DeleteErrorPage(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
	var res gophercloud.ErrResult
	_, res.Err = client.Delete(errorPageURL(client, id), &gophercloud.RequestOpts{
		OkCodes: []int{200},
	})
	return res
}
// Revoke immediately makes specified token invalid.
func Revoke(c *gophercloud.ServiceClient, token string) RevokeResult {
	var res RevokeResult
	_, res.Err = c.Delete(tokenURL(c), &gophercloud.RequestOpts{
		MoreHeaders: subjectTokenHeaders(c, token),
	})
	return res
}
Example #7
0
// Abandon deletes the stack with the provided stackName and stackID, but leaves its
// resources intact, and returns data describing the stack and its resources.
func Abandon(c *gophercloud.ServiceClient, stackName, stackID string) AbandonResult {
	var res AbandonResult
	_, res.Err = c.Delete(abandonURL(c, stackName, stackID), &gophercloud.RequestOpts{
		JSONResponse: &res.Body,
		OkCodes:      []int{200},
	})
	return res
}
Example #8
0
//OpenstackDelete deletes a resource using OpenStack API
func OpenstackDelete(client *gophercloud.ServiceClient, url string) (interface{}, error) {
	_, err := client.Delete(url, &gophercloud.RequestOpts{
		OkCodes: []int{200, 201, 202, 204, 404},
	})
	if err != nil {
		return nil, err
	}
	return nil, nil
}
Example #9
0
// Delete requests the given policy be permanently deleted.
func Delete(client *gophercloud.ServiceClient, groupID, policyID string) DeleteResult {
	var result DeleteResult

	url := deleteURL(client, groupID, policyID)
	_, result.Err = client.Delete(url, &gophercloud.RequestOpts{
		OkCodes: []int{204},
	})

	return result
}
Example #10
0
// Delete accepts a unique service ID or URL and deletes the CDN service asset associated with
// it. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
func Delete(c *gophercloud.ServiceClient, idOrURL string, opts DeleteOptsBuilder) DeleteResult {
	var url string
	if strings.Contains(idOrURL, "/") {
		url = idOrURL
	} else {
		url = deleteURL(c, idOrURL)
	}

	var res DeleteResult
	_, res.Err = c.Delete(url, nil)
	return res
}
Example #11
0
// BulkDelete will delete multiple network items from a load balancer's access
// list in a single operation.
func BulkDelete(c *gophercloud.ServiceClient, loadBalancerID int, itemIDs []int) DeleteResult {
	var res DeleteResult

	if len(itemIDs) > 10 || len(itemIDs) == 0 {
		res.Err = errors.New("You must provide a minimum of 1 and a maximum of 10 item IDs")
		return res
	}

	url := rootURL(c, loadBalancerID)
	url += gophercloud.IDSliceToQueryString("id", itemIDs)

	_, res.Err = c.Delete(url, nil)
	return res
}
Example #12
0
// Delete membership for given image.
// Callee should be image owner
// More details: http://developer.openstack.org/api-ref-image-v2.html#deleteImageMember-v2
func Delete(client *gophercloud.ServiceClient, imageID string, memberID string) MemberDeleteResult {
	var res MemberDeleteResult
	response, err := client.Delete(imageMemberURL(client, imageID, memberID), &gophercloud.RequestOpts{OkCodes: []int{204, 403}})

	//some problems in http stack or lower
	if err != nil {
		res.Err = err
		return res
	}

	// Callee is not owner of specified image
	if response.StatusCode == 403 {
		res.Err = fmt.Errorf("You must be the owner of the specified image. "+
			"(image '%s')", imageID)
		return res
	}
	return res
}
Example #13
0
// Delete is a function that deletes an object.
func Delete(c *gophercloud.ServiceClient, containerName, objectName string, opts DeleteOptsBuilder) DeleteResult {
	var res DeleteResult
	url := deleteURL(c, containerName, objectName)

	if opts != nil {
		query, err := opts.ToObjectDeleteQuery()
		if err != nil {
			res.Err = err
			return res
		}
		url += query
	}

	resp, err := c.Delete(url, nil)
	res.Header = resp.Header
	res.Err = err
	return res
}
Example #14
0
// DisassociateMonitor will disassociate a health monitor with a particular
// pool. When dissociation is successful, the health monitor will no longer
// check for the health of the members of the pool.
func DisassociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) AssociateResult {
	var res AssociateResult
	_, res.Err = c.Delete(disassociateURL(c, poolID, monitorID), nil)
	return res
}
Example #15
0
// Delete removes an existing service.
// It either deletes all associated endpoints, or fails until all endpoints are deleted.
func Delete(client *gophercloud.ServiceClient, serviceID string) DeleteResult {
	var res DeleteResult
	_, res.Err = client.Delete(serviceURL(client, serviceID), nil)
	return res
}
Example #16
0
// Delete requests the deletion of a previous stored VolumeAttachment from the server.
func Delete(client *gophercloud.ServiceClient, serverId, aId string) DeleteResult {
	var res DeleteResult
	_, res.Err = client.Delete(deleteURL(client, serverId, aId), nil)
	return res
}
Example #17
0
// Delete is a function that deletes a container.
func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(deleteURL(c, containerName), nil)
	return res
}
Example #18
0
// Delete is the operation responsible for deleting a health monitor.
func Delete(c *gophercloud.ServiceClient, id int) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(rootURL(c, id), nil)
	return res
}
Example #19
0
// DeleteUserRole is the operation responsible for deleting a particular role
// from a user. This is confined to the scope of the user's tenant - so the
// tenant ID is a required argument.
func DeleteUserRole(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {
	var result UserRoleResult
	_, result.Err = client.Delete(userRoleURL(client, tenantID, userID, roleID), nil)
	return result
}
Example #20
0
// DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) DeleteMetadatumResult {
	var res DeleteMetadatumResult
	_, res.Err = client.Delete(metadatumURL(client, id, key), nil)
	return res
}
Example #21
0
// Delete accepts a unique ID and deletes the project associated with it.
func Delete(client *gophercloud.ServiceClient, projectID string) DeleteResult {
	var result DeleteResult
	_, result.Err = client.Delete(deleteURL(client, projectID), nil)
	return result
}
Example #22
0
// Delete will remove a single network item from a load balancer's access list.
func Delete(c *gophercloud.ServiceClient, lbID, itemID int) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(resourceURL(c, lbID, itemID), nil)
	return res
}
Example #23
0
// Delete accepts a unique ID and deletes the port associated with it.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(deleteURL(c, id), nil)
	return res
}
Example #24
0
// Delete deletes a stack based on the stack name and stack ID.
func Delete(c *gophercloud.ServiceClient, stackName, stackID string) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(deleteURL(c, stackName, stackID), nil)
	return res
}
Example #25
0
// DisassociateMember will remove and disassociate a Member from a particular Pool.
func DeleteMember(c *gophercloud.ServiceClient, poolID string, memberID string) DeleteResult {
	var res DeleteResult
	_, res.Err = c.Delete(memberResourceURL(c, poolID, memberID), nil)
	return res
}
Example #26
0
// DeleteNode removes the node with the given nodeID from the LB pool with the
// given poolID.
func DeleteNode(c *gophercloud.ServiceClient, poolID, nodeID string) DeleteNodeResult {
	var res DeleteNodeResult
	_, res.Err = c.Delete(deleteNodeURL(c, poolID, nodeID), nil)
	return res
}
Example #27
0
// Delete is the operation responsible for permanently deleting an API user.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
	var result DeleteResult
	_, result.Err = client.Delete(ResourceURL(client, id), nil)
	return result
}
Example #28
0
// Disable is the operation responsible for disabling session persistence for a
// particular load balancer.
func Disable(c *gophercloud.ServiceClient, lbID int) DisableResult {
	var res DisableResult
	_, res.Err = c.Delete(rootURL(c, lbID), nil)
	return res
}