repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_role_v3.go
dataSourceIdentityRoleV3Read
func dataSourceIdentityRoleV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } listOpts := roles.ListOpts{ DomainID: d.Get...
go
func dataSourceIdentityRoleV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } listOpts := roles.ListOpts{ DomainID: d.Get...
[ "func", "dataSourceIdentityRoleV3Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "identityClient", ",", "err", ":=", "config", ".", "i...
// dataSourceIdentityRoleV3Read performs the role lookup.
[ "dataSourceIdentityRoleV3Read", "performs", "the", "role", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_role_v3.go#L38-L74
train
terraform-providers/terraform-provider-openstack
openstack/identity_role_assignment_v3.go
identityRoleAssignmentV3ID
func identityRoleAssignmentV3ID(domainID, projectID, groupID, userID, roleID string) string { return fmt.Sprintf("%s/%s/%s/%s/%s", domainID, projectID, groupID, userID, roleID) }
go
func identityRoleAssignmentV3ID(domainID, projectID, groupID, userID, roleID string) string { return fmt.Sprintf("%s/%s/%s/%s/%s", domainID, projectID, groupID, userID, roleID) }
[ "func", "identityRoleAssignmentV3ID", "(", "domainID", ",", "projectID", ",", "groupID", ",", "userID", ",", "roleID", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "domainID", ",", "projectID", ",", "groupID", ",", "...
// Role assignments have no ID in OpenStack. // Build an ID out of the IDs that make up the role assignment
[ "Role", "assignments", "have", "no", "ID", "in", "OpenStack", ".", "Build", "an", "ID", "out", "of", "the", "IDs", "that", "make", "up", "the", "role", "assignment" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/identity_role_assignment_v3.go#L14-L16
train
terraform-providers/terraform-provider-openstack
openstack/resource_openstack_networking_subnet_v2.go
resourceSubnetAllocationPoolsCreateV2
func resourceSubnetAllocationPoolsCreateV2(d *schema.ResourceData) []subnets.AllocationPool { // First check allocation_pool since that is the new argument. rawAPs := d.Get("allocation_pool").(*schema.Set).List() if len(rawAPs) == 0 { // If no allocation_pool was specified, check allocation_pools // which is th...
go
func resourceSubnetAllocationPoolsCreateV2(d *schema.ResourceData) []subnets.AllocationPool { // First check allocation_pool since that is the new argument. rawAPs := d.Get("allocation_pool").(*schema.Set).List() if len(rawAPs) == 0 { // If no allocation_pool was specified, check allocation_pools // which is th...
[ "func", "resourceSubnetAllocationPoolsCreateV2", "(", "d", "*", "schema", ".", "ResourceData", ")", "[", "]", "subnets", ".", "AllocationPool", "{", "// First check allocation_pool since that is the new argument.", "rawAPs", ":=", "d", ".", "Get", "(", "\"", "\"", ")"...
// resourceSubnetAllocationPoolsCreateV2 returns a slice of allocation pools // when creating a subnet. It takes into account both the old allocation_pools // argument as well as the new allocation_pool argument. // // This can be modified to only account for allocation_pool when // allocation_pools is removed.
[ "resourceSubnetAllocationPoolsCreateV2", "returns", "a", "slice", "of", "allocation", "pools", "when", "creating", "a", "subnet", ".", "It", "takes", "into", "account", "both", "the", "old", "allocation_pools", "argument", "as", "well", "as", "the", "new", "alloca...
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/resource_openstack_networking_subnet_v2.go#L474-L493
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_project_v3.go
dataSourceIdentityProjectV3Read
func dataSourceIdentityProjectV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } enabled := d.Get("enabled").(bool) isDoma...
go
func dataSourceIdentityProjectV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } enabled := d.Get("enabled").(bool) isDoma...
[ "func", "dataSourceIdentityProjectV3Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "identityClient", ",", "err", ":=", "config", ".", ...
// dataSourceIdentityProjectV3Read performs the project lookup.
[ "dataSourceIdentityProjectV3Read", "performs", "the", "project", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_project_v3.go#L60-L102
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_project_v3.go
dataSourceIdentityProjectV3Attributes
func dataSourceIdentityProjectV3Attributes(d *schema.ResourceData, project *projects.Project) error { log.Printf("[DEBUG] openstack_identity_project_v3 details: %#v", project) d.SetId(project.ID) d.Set("is_domain", project.IsDomain) d.Set("description", project.Description) d.Set("domain_id", project.DomainID) d...
go
func dataSourceIdentityProjectV3Attributes(d *schema.ResourceData, project *projects.Project) error { log.Printf("[DEBUG] openstack_identity_project_v3 details: %#v", project) d.SetId(project.ID) d.Set("is_domain", project.IsDomain) d.Set("description", project.Description) d.Set("domain_id", project.DomainID) d...
[ "func", "dataSourceIdentityProjectV3Attributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "project", "*", "projects", ".", "Project", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "project", ")", "\n\n", "d", ".", "SetId", "(", ...
// dataSourceIdentityProjectV3Attributes populates the fields of an Project resource.
[ "dataSourceIdentityProjectV3Attributes", "populates", "the", "fields", "of", "an", "Project", "resource", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_project_v3.go#L105-L117
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_compute_flavor_v2.go
dataSourceComputeFlavorV2Attributes
func dataSourceComputeFlavorV2Attributes( d *schema.ResourceData, computeClient *gophercloud.ServiceClient, flavor *flavors.Flavor) error { log.Printf("[DEBUG] Retrieved openstack_compute_flavor_v2 %s: %#v", flavor.ID, flavor) d.SetId(flavor.ID) d.Set("name", flavor.Name) d.Set("flavor_id", flavor.ID) d.Set("di...
go
func dataSourceComputeFlavorV2Attributes( d *schema.ResourceData, computeClient *gophercloud.ServiceClient, flavor *flavors.Flavor) error { log.Printf("[DEBUG] Retrieved openstack_compute_flavor_v2 %s: %#v", flavor.ID, flavor) d.SetId(flavor.ID) d.Set("name", flavor.Name) d.Set("flavor_id", flavor.ID) d.Set("di...
[ "func", "dataSourceComputeFlavorV2Attributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "computeClient", "*", "gophercloud", ".", "ServiceClient", ",", "flavor", "*", "flavors", ".", "Flavor", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"",...
// dataSourceComputeFlavorV2Attributes populates the fields of a Flavor resource.
[ "dataSourceComputeFlavorV2Attributes", "populates", "the", "fields", "of", "a", "Flavor", "resource", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_compute_flavor_v2.go#L198-L223
train
terraform-providers/terraform-provider-openstack
openstack/resource_openstack_objectstorage_tempurl_v1.go
resourceObjectstorageTempurlV1Create
func resourceObjectstorageTempurlV1Create(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) objectStorageClient, err := config.objectStorageV1Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack compute client: %s", err) } method := objects.GET switc...
go
func resourceObjectstorageTempurlV1Create(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) objectStorageClient, err := config.objectStorageV1Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack compute client: %s", err) } method := objects.GET switc...
[ "func", "resourceObjectstorageTempurlV1Create", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "objectStorageClient", ",", "err", ":=", "config"...
// resourceObjectstorageTempurlV1Create performs the image lookup.
[ "resourceObjectstorageTempurlV1Create", "performs", "the", "image", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/resource_openstack_objectstorage_tempurl_v1.go#L85-L127
train
terraform-providers/terraform-provider-openstack
openstack/resource_openstack_objectstorage_tempurl_v1.go
resourceObjectstorageTempurlV1Read
func resourceObjectstorageTempurlV1Read(d *schema.ResourceData, meta interface{}) error { turl := d.Get("url").(string) u, err := url.Parse(turl) if err != nil { return fmt.Errorf("Failed to read the temporary url %s: %s", turl, err) } qp, err := url.ParseQuery(u.RawQuery) if err != nil { return fmt.Errorf("...
go
func resourceObjectstorageTempurlV1Read(d *schema.ResourceData, meta interface{}) error { turl := d.Get("url").(string) u, err := url.Parse(turl) if err != nil { return fmt.Errorf("Failed to read the temporary url %s: %s", turl, err) } qp, err := url.ParseQuery(u.RawQuery) if err != nil { return fmt.Errorf("...
[ "func", "resourceObjectstorageTempurlV1Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "turl", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "u", ",", "err", ":...
// resourceObjectstorageTempurlV1Read performs the image lookup.
[ "resourceObjectstorageTempurlV1Read", "performs", "the", "image", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/resource_openstack_objectstorage_tempurl_v1.go#L130-L159
train
terraform-providers/terraform-provider-openstack
openstack/util.go
BuildRequest
func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error) { b, err := gophercloud.BuildRequestBody(opts, "") if err != nil { return nil, err } b = AddValueSpecs(b) return map[string]interface{}{parent: b}, nil }
go
func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error) { b, err := gophercloud.BuildRequestBody(opts, "") if err != nil { return nil, err } b = AddValueSpecs(b) return map[string]interface{}{parent: b}, nil }
[ "func", "BuildRequest", "(", "opts", "interface", "{", "}", ",", "parent", "string", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "b", ",", "err", ":=", "gophercloud", ".", "BuildRequestBody", "(", "opts", ",", ...
// BuildRequest takes an opts struct and builds a request body for // Gophercloud to execute
[ "BuildRequest", "takes", "an", "opts", "struct", "and", "builds", "a", "request", "body", "for", "Gophercloud", "to", "execute" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L22-L31
train
terraform-providers/terraform-provider-openstack
openstack/util.go
GetRegion
func GetRegion(d *schema.ResourceData, config *Config) string { if v, ok := d.GetOk("region"); ok { return v.(string) } return config.Region }
go
func GetRegion(d *schema.ResourceData, config *Config) string { if v, ok := d.GetOk("region"); ok { return v.(string) } return config.Region }
[ "func", "GetRegion", "(", "d", "*", "schema", ".", "ResourceData", ",", "config", "*", "Config", ")", "string", "{", "if", "v", ",", "ok", ":=", "d", ".", "GetOk", "(", "\"", "\"", ")", ";", "ok", "{", "return", "v", ".", "(", "string", ")", "\...
// GetRegion returns the region that was specified in the resource. If a // region was not set, the provider-level region is checked. The provider-level // region can either be set by the region argument or by OS_REGION_NAME.
[ "GetRegion", "returns", "the", "region", "that", "was", "specified", "in", "the", "resource", ".", "If", "a", "region", "was", "not", "set", "the", "provider", "-", "level", "region", "is", "checked", ".", "The", "provider", "-", "level", "region", "can", ...
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L47-L53
train
terraform-providers/terraform-provider-openstack
openstack/util.go
AddValueSpecs
func AddValueSpecs(body map[string]interface{}) map[string]interface{} { if body["value_specs"] != nil { for k, v := range body["value_specs"].(map[string]interface{}) { body[k] = v } delete(body, "value_specs") } return body }
go
func AddValueSpecs(body map[string]interface{}) map[string]interface{} { if body["value_specs"] != nil { for k, v := range body["value_specs"].(map[string]interface{}) { body[k] = v } delete(body, "value_specs") } return body }
[ "func", "AddValueSpecs", "(", "body", "map", "[", "string", "]", "interface", "{", "}", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "if", "body", "[", "\"", "\"", "]", "!=", "nil", "{", "for", "k", ",", "v", ":=", "range", "body",...
// AddValueSpecs expands the 'value_specs' object and removes 'value_specs' // from the reqeust body.
[ "AddValueSpecs", "expands", "the", "value_specs", "object", "and", "removes", "value_specs", "from", "the", "reqeust", "body", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L57-L66
train
terraform-providers/terraform-provider-openstack
openstack/util.go
MapValueSpecs
func MapValueSpecs(d *schema.ResourceData) map[string]string { m := make(map[string]string) for key, val := range d.Get("value_specs").(map[string]interface{}) { m[key] = val.(string) } return m }
go
func MapValueSpecs(d *schema.ResourceData) map[string]string { m := make(map[string]string) for key, val := range d.Get("value_specs").(map[string]interface{}) { m[key] = val.(string) } return m }
[ "func", "MapValueSpecs", "(", "d", "*", "schema", ".", "ResourceData", ")", "map", "[", "string", "]", "string", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "key", ",", "val", ":=", "range", "d", ".", "Get", ...
// MapValueSpecs converts ResourceData into a map
[ "MapValueSpecs", "converts", "ResourceData", "into", "a", "map" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L69-L75
train
terraform-providers/terraform-provider-openstack
openstack/util.go
RedactHeaders
func RedactHeaders(headers http.Header) (processedHeaders []string) { for name, header := range headers { for _, v := range header { if com.IsSliceContainsStr(REDACT_HEADERS, name) { processedHeaders = append(processedHeaders, fmt.Sprintf("%v: %v", name, "***")) } else { processedHeaders = append(proce...
go
func RedactHeaders(headers http.Header) (processedHeaders []string) { for name, header := range headers { for _, v := range header { if com.IsSliceContainsStr(REDACT_HEADERS, name) { processedHeaders = append(processedHeaders, fmt.Sprintf("%v: %v", name, "***")) } else { processedHeaders = append(proce...
[ "func", "RedactHeaders", "(", "headers", "http", ".", "Header", ")", "(", "processedHeaders", "[", "]", "string", ")", "{", "for", "name", ",", "header", ":=", "range", "headers", "{", "for", "_", ",", "v", ":=", "range", "header", "{", "if", "com", ...
// RedactHeaders processes a headers object, returning a redacted list
[ "RedactHeaders", "processes", "a", "headers", "object", "returning", "a", "redacted", "list" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L84-L95
train
terraform-providers/terraform-provider-openstack
openstack/util.go
FormatHeaders
func FormatHeaders(headers http.Header, seperator string) string { redactedHeaders := RedactHeaders(headers) sort.Strings(redactedHeaders) return strings.Join(redactedHeaders, seperator) }
go
func FormatHeaders(headers http.Header, seperator string) string { redactedHeaders := RedactHeaders(headers) sort.Strings(redactedHeaders) return strings.Join(redactedHeaders, seperator) }
[ "func", "FormatHeaders", "(", "headers", "http", ".", "Header", ",", "seperator", "string", ")", "string", "{", "redactedHeaders", ":=", "RedactHeaders", "(", "headers", ")", "\n", "sort", ".", "Strings", "(", "redactedHeaders", ")", "\n\n", "return", "strings...
// FormatHeaders processes a headers object plus a deliminator, returning a string
[ "FormatHeaders", "processes", "a", "headers", "object", "plus", "a", "deliminator", "returning", "a", "string" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L98-L103
train
terraform-providers/terraform-provider-openstack
openstack/util.go
compatibleMicroversion
func compatibleMicroversion(direction, required, given string) (bool, error) { if direction != "min" && direction != "max" { return false, fmt.Errorf("Invalid microversion direction %s. Must be min or max", direction) } if required == "" || given == "" { return false, nil } requiredParts := strings.Split(req...
go
func compatibleMicroversion(direction, required, given string) (bool, error) { if direction != "min" && direction != "max" { return false, fmt.Errorf("Invalid microversion direction %s. Must be min or max", direction) } if required == "" || given == "" { return false, nil } requiredParts := strings.Split(req...
[ "func", "compatibleMicroversion", "(", "direction", ",", "required", ",", "given", "string", ")", "(", "bool", ",", "error", ")", "{", "if", "direction", "!=", "\"", "\"", "&&", "direction", "!=", "\"", "\"", "{", "return", "false", ",", "fmt", ".", "E...
// compatibleMicroversion will determine if an obtained microversion is // compatible with a given microversion.
[ "compatibleMicroversion", "will", "determine", "if", "an", "obtained", "microversion", "is", "compatible", "with", "a", "given", "microversion", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/util.go#L278-L336
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_images_image_v2.go
dataSourceImagesImageV2Attributes
func dataSourceImagesImageV2Attributes(d *schema.ResourceData, image *images.Image) error { log.Printf("[DEBUG] openstack_images_image details: %#v", image) d.SetId(image.ID) d.Set("name", image.Name) d.Set("tags", image.Tags) d.Set("container_format", image.ContainerFormat) d.Set("disk_format", image.DiskFormat...
go
func dataSourceImagesImageV2Attributes(d *schema.ResourceData, image *images.Image) error { log.Printf("[DEBUG] openstack_images_image details: %#v", image) d.SetId(image.ID) d.Set("name", image.Name) d.Set("tags", image.Tags) d.Set("container_format", image.ContainerFormat) d.Set("disk_format", image.DiskFormat...
[ "func", "dataSourceImagesImageV2Attributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "image", "*", "images", ".", "Image", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "image", ")", "\n\n", "d", ".", "SetId", "(", "image", ...
// dataSourceImagesImageV2Attributes populates the fields of an Image resource.
[ "dataSourceImagesImageV2Attributes", "populates", "the", "fields", "of", "an", "Image", "resource", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_images_image_v2.go#L262-L284
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_images_image_v2.go
mostRecentImage
func mostRecentImage(images []images.Image) images.Image { sortedImages := images sort.Sort(imageSort(sortedImages)) return sortedImages[len(sortedImages)-1] }
go
func mostRecentImage(images []images.Image) images.Image { sortedImages := images sort.Sort(imageSort(sortedImages)) return sortedImages[len(sortedImages)-1] }
[ "func", "mostRecentImage", "(", "images", "[", "]", "images", ".", "Image", ")", "images", ".", "Image", "{", "sortedImages", ":=", "images", "\n", "sort", ".", "Sort", "(", "imageSort", "(", "sortedImages", ")", ")", "\n", "return", "sortedImages", "[", ...
// Returns the most recent Image out of a slice of images.
[ "Returns", "the", "most", "recent", "Image", "out", "of", "a", "slice", "of", "images", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_images_image_v2.go#L297-L301
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_group_v3.go
dataSourceIdentityGroupV3Read
func dataSourceIdentityGroupV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } listOpts := groups.ListOpts{ DomainID: d.G...
go
func dataSourceIdentityGroupV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } listOpts := groups.ListOpts{ DomainID: d.G...
[ "func", "dataSourceIdentityGroupV3Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "identityClient", ",", "err", ":=", "config", ".", "...
// dataSourceIdentityGroupV3Read performs the group lookup.
[ "dataSourceIdentityGroupV3Read", "performs", "the", "group", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_group_v3.go#L38-L75
train
terraform-providers/terraform-provider-openstack
openstack/dns_recordset_v2.go
ToRecordSetCreateMap
func (opts RecordSetCreateOpts) ToRecordSetCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "") if err != nil { return nil, err } if m, ok := b[""].(map[string]interface{}); ok { return m, nil } return nil, fmt.Errorf("Expected map but got %T", b[""]) }
go
func (opts RecordSetCreateOpts) ToRecordSetCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "") if err != nil { return nil, err } if m, ok := b[""].(map[string]interface{}); ok { return m, nil } return nil, fmt.Errorf("Expected map but got %T", b[""]) }
[ "func", "(", "opts", "RecordSetCreateOpts", ")", "ToRecordSetCreateMap", "(", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "b", ",", "err", ":=", "BuildRequest", "(", "opts", ",", "\"", "\"", ")", "\n", "if", "e...
// ToRecordSetCreateMap casts a CreateOpts struct to a map. // It overrides recordsets.ToRecordSetCreateMap to add the ValueSpecs field.
[ "ToRecordSetCreateMap", "casts", "a", "CreateOpts", "struct", "to", "a", "map", ".", "It", "overrides", "recordsets", ".", "ToRecordSetCreateMap", "to", "add", "the", "ValueSpecs", "field", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/dns_recordset_v2.go#L23-L34
train
terraform-providers/terraform-provider-openstack
openstack/dns_recordset_v2.go
dnsRecordSetV2RecordsStateFunc
func dnsRecordSetV2RecordsStateFunc(v interface{}) string { if addr, ok := v.(string); ok { re := regexp.MustCompile("[][]") addr = re.ReplaceAllString(addr, "") return addr } return "" }
go
func dnsRecordSetV2RecordsStateFunc(v interface{}) string { if addr, ok := v.(string); ok { re := regexp.MustCompile("[][]") addr = re.ReplaceAllString(addr, "") return addr } return "" }
[ "func", "dnsRecordSetV2RecordsStateFunc", "(", "v", "interface", "{", "}", ")", "string", "{", "if", "addr", ",", "ok", ":=", "v", ".", "(", "string", ")", ";", "ok", "{", "re", ":=", "regexp", ".", "MustCompile", "(", "\"", "\"", ")", "\n", "addr", ...
// dnsRecordSetV2RecordsStateFunc will strip brackets from IPv6 addresses.
[ "dnsRecordSetV2RecordsStateFunc", "will", "strip", "brackets", "from", "IPv6", "addresses", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/dns_recordset_v2.go#L82-L91
train
terraform-providers/terraform-provider-openstack
openstack/db_database_v1.go
databaseDatabaseV1StateRefreshFunc
func databaseDatabaseV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, dbName string) resource.StateRefreshFunc { return func() (interface{}, string, error) { pages, err := databases.List(client, instanceID).AllPages() if err != nil { return nil, "", fmt.Errorf("Unable to retrieve OpenSta...
go
func databaseDatabaseV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, dbName string) resource.StateRefreshFunc { return func() (interface{}, string, error) { pages, err := databases.List(client, instanceID).AllPages() if err != nil { return nil, "", fmt.Errorf("Unable to retrieve OpenSta...
[ "func", "databaseDatabaseV1StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "instanceID", "string", ",", "dbName", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",...
// databaseDatabaseV1StateRefreshFunc returns a resource.StateRefreshFunc // that is used to watch a database.
[ "databaseDatabaseV1StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "a", "database", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/db_database_v1.go#L14-L34
train
terraform-providers/terraform-provider-openstack
openstack/db_user_v1.go
databaseUserV1StateRefreshFunc
func databaseUserV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, userName string) resource.StateRefreshFunc { return func() (interface{}, string, error) { pages, err := users.List(client, instanceID).AllPages() if err != nil { return nil, "", fmt.Errorf("Unable to retrieve OpenStack dat...
go
func databaseUserV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, userName string) resource.StateRefreshFunc { return func() (interface{}, string, error) { pages, err := users.List(client, instanceID).AllPages() if err != nil { return nil, "", fmt.Errorf("Unable to retrieve OpenStack dat...
[ "func", "databaseUserV1StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "instanceID", "string", ",", "userName", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",",...
// databaseUserV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch db user.
[ "databaseUserV1StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "db", "user", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/db_user_v1.go#L35-L55
train
terraform-providers/terraform-provider-openstack
openstack/db_user_v1.go
databaseUserV1Exists
func databaseUserV1Exists(client *gophercloud.ServiceClient, instanceID string, userName string) (bool, users.User, error) { var exists bool var err error var userObj users.User pages, err := users.List(client, instanceID).AllPages() if err != nil { return exists, userObj, err } allUsers, err := users.Extrac...
go
func databaseUserV1Exists(client *gophercloud.ServiceClient, instanceID string, userName string) (bool, users.User, error) { var exists bool var err error var userObj users.User pages, err := users.List(client, instanceID).AllPages() if err != nil { return exists, userObj, err } allUsers, err := users.Extrac...
[ "func", "databaseUserV1Exists", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "instanceID", "string", ",", "userName", "string", ")", "(", "bool", ",", "users", ".", "User", ",", "error", ")", "{", "var", "exists", "bool", "\n", "var", "err...
// databaseUserV1Exists is used to check whether user exists on particular database instance
[ "databaseUserV1Exists", "is", "used", "to", "check", "whether", "user", "exists", "on", "particular", "database", "instance" ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/db_user_v1.go#L58-L81
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_user_v3.go
dataSourceIdentityUserV3Read
func dataSourceIdentityUserV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } enabled := d.Get("enabled").(bool) listOpts ...
go
func dataSourceIdentityUserV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } enabled := d.Get("enabled").(bool) listOpts ...
[ "func", "dataSourceIdentityUserV3Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "identityClient", ",", "err", ":=", "config", ".", "i...
// dataSourceIdentityUserV3Read performs the user lookup.
[ "dataSourceIdentityUserV3Read", "performs", "the", "user", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_user_v3.go#L71-L114
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_user_v3.go
dataSourceIdentityUserV3Attributes
func dataSourceIdentityUserV3Attributes(d *schema.ResourceData, user *users.User) error { log.Printf("[DEBUG] openstack_identity_user_v3 details: %#v", user) d.SetId(user.ID) d.Set("default_project_id", user.DefaultProjectID) d.Set("description", user.Description) d.Set("domain_id", user.DomainID) d.Set("enabled...
go
func dataSourceIdentityUserV3Attributes(d *schema.ResourceData, user *users.User) error { log.Printf("[DEBUG] openstack_identity_user_v3 details: %#v", user) d.SetId(user.ID) d.Set("default_project_id", user.DefaultProjectID) d.Set("description", user.Description) d.Set("domain_id", user.DomainID) d.Set("enabled...
[ "func", "dataSourceIdentityUserV3Attributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "user", "*", "users", ".", "User", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "user", ")", "\n\n", "d", ".", "SetId", "(", "user", ".",...
// dataSourceIdentityUserV3Attributes populates the fields of an User resource.
[ "dataSourceIdentityUserV3Attributes", "populates", "the", "fields", "of", "an", "User", "resource", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_user_v3.go#L117-L129
train
terraform-providers/terraform-provider-openstack
openstack/db_configuration_v1.go
databaseConfigurationV1StateRefreshFunc
func databaseConfigurationV1StateRefreshFunc(client *gophercloud.ServiceClient, cgroupID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { i, err := configurations.Get(client, cgroupID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return i, "DELE...
go
func databaseConfigurationV1StateRefreshFunc(client *gophercloud.ServiceClient, cgroupID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { i, err := configurations.Get(client, cgroupID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return i, "DELE...
[ "func", "databaseConfigurationV1StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "cgroupID", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",", "string", ",", "err...
// databaseConfigurationV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch // an cloud database instance.
[ "databaseConfigurationV1StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "an", "cloud", "database", "instance", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/db_configuration_v1.go#L43-L55
train
terraform-providers/terraform-provider-openstack
openstack/resource_openstack_compute_instance_v2.go
ServerV2StateRefreshFunc
func ServerV2StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { s, err := servers.Get(client, instanceID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return s, "DELETED", nil } ...
go
func ServerV2StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { s, err := servers.Get(client, instanceID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return s, "DELETED", nil } ...
[ "func", "ServerV2StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "instanceID", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",", "string", ",", "error", ")", ...
// ServerV2StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch // an OpenStack instance.
[ "ServerV2StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "an", "OpenStack", "instance", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/resource_openstack_compute_instance_v2.go#L950-L962
train
terraform-providers/terraform-provider-openstack
openstack/config.go
determineEndpoint
func (c *Config) determineEndpoint(client *gophercloud.ServiceClient, service string) *gophercloud.ServiceClient { finalEndpoint := client.ResourceBaseURL() if v, ok := c.EndpointOverrides[service]; ok { if endpoint, ok := v.(string); ok && endpoint != "" { finalEndpoint = endpoint client.Endpoint = endpoint...
go
func (c *Config) determineEndpoint(client *gophercloud.ServiceClient, service string) *gophercloud.ServiceClient { finalEndpoint := client.ResourceBaseURL() if v, ok := c.EndpointOverrides[service]; ok { if endpoint, ok := v.(string); ok && endpoint != "" { finalEndpoint = endpoint client.Endpoint = endpoint...
[ "func", "(", "c", "*", "Config", ")", "determineEndpoint", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "service", "string", ")", "*", "gophercloud", ".", "ServiceClient", "{", "finalEndpoint", ":=", "client", ".", "ResourceBaseURL", "(", ")",...
// determineEndpoint is a helper method to determine if the user wants to // override an endpoint returned from the catalog.
[ "determineEndpoint", "is", "a", "helper", "method", "to", "determine", "if", "the", "user", "wants", "to", "override", "an", "endpoint", "returned", "from", "the", "catalog", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/config.go#L219-L233
train
terraform-providers/terraform-provider-openstack
openstack/config.go
determineRegion
func (c *Config) determineRegion(region string) string { // If a resource-level region was not specified, and a provider-level region was set, // use the provider-level region. if region == "" && c.Region != "" { region = c.Region } log.Printf("[DEBUG] OpenStack Region is: %s", region) return region }
go
func (c *Config) determineRegion(region string) string { // If a resource-level region was not specified, and a provider-level region was set, // use the provider-level region. if region == "" && c.Region != "" { region = c.Region } log.Printf("[DEBUG] OpenStack Region is: %s", region) return region }
[ "func", "(", "c", "*", "Config", ")", "determineRegion", "(", "region", "string", ")", "string", "{", "// If a resource-level region was not specified, and a provider-level region was set,", "// use the provider-level region.", "if", "region", "==", "\"", "\"", "&&", "c", ...
// determineRegion is a helper method to determine the region based on // the user's settings.
[ "determineRegion", "is", "a", "helper", "method", "to", "determine", "the", "region", "based", "on", "the", "user", "s", "settings", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/config.go#L237-L246
train
terraform-providers/terraform-provider-openstack
openstack/config.go
blockStorageV1Client
func (c *Config) blockStorageV1Client(region string) (*gophercloud.ServiceClient, error) { client, err := openstack.NewBlockStorageV1(c.OsClient, gophercloud.EndpointOpts{ Region: c.determineRegion(region), Availability: c.getEndpointType(), }) if err != nil { return client, err } // Check if an endp...
go
func (c *Config) blockStorageV1Client(region string) (*gophercloud.ServiceClient, error) { client, err := openstack.NewBlockStorageV1(c.OsClient, gophercloud.EndpointOpts{ Region: c.determineRegion(region), Availability: c.getEndpointType(), }) if err != nil { return client, err } // Check if an endp...
[ "func", "(", "c", "*", "Config", ")", "blockStorageV1Client", "(", "region", "string", ")", "(", "*", "gophercloud", ".", "ServiceClient", ",", "error", ")", "{", "client", ",", "err", ":=", "openstack", ".", "NewBlockStorageV1", "(", "c", ".", "OsClient",...
// The following methods assist with the creation of individual Service Clients // which interact with the various OpenStack services.
[ "The", "following", "methods", "assist", "with", "the", "creation", "of", "individual", "Service", "Clients", "which", "interact", "with", "the", "various", "OpenStack", "services", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/config.go#L263-L277
train
terraform-providers/terraform-provider-openstack
openstack/networking_network_v2.go
networkingNetworkV2Name
func networkingNetworkV2Name(d *schema.ResourceData, meta interface{}, networkID string) (string, error) { config := meta.(*Config) networkingClient, err := config.networkingV2Client(GetRegion(d, config)) if err != nil { return "", fmt.Errorf("Error creating OpenStack network client: %s", err) } opts := network...
go
func networkingNetworkV2Name(d *schema.ResourceData, meta interface{}, networkID string) (string, error) { config := meta.(*Config) networkingClient, err := config.networkingV2Client(GetRegion(d, config)) if err != nil { return "", fmt.Errorf("Error creating OpenStack network client: %s", err) } opts := network...
[ "func", "networkingNetworkV2Name", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "networkID", "string", ")", "(", "string", ",", "error", ")", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "ne...
// networkingNetworkV2Name retrieves network name by the provided ID.
[ "networkingNetworkV2Name", "retrieves", "network", "name", "by", "the", "provided", "ID", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/networking_network_v2.go#L62-L90
train
terraform-providers/terraform-provider-openstack
openstack/networking_floatingip_v2.go
networkingFloatingIPV2ID
func networkingFloatingIPV2ID(client *gophercloud.ServiceClient, floatingIP string) (string, error) { listOpts := floatingips.ListOpts{ FloatingIP: floatingIP, } allPages, err := floatingips.List(client, listOpts).AllPages() if err != nil { return "", err } allFloatingIPs, err := floatingips.ExtractFloating...
go
func networkingFloatingIPV2ID(client *gophercloud.ServiceClient, floatingIP string) (string, error) { listOpts := floatingips.ListOpts{ FloatingIP: floatingIP, } allPages, err := floatingips.List(client, listOpts).AllPages() if err != nil { return "", err } allFloatingIPs, err := floatingips.ExtractFloating...
[ "func", "networkingFloatingIPV2ID", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "floatingIP", "string", ")", "(", "string", ",", "error", ")", "{", "listOpts", ":=", "floatingips", ".", "ListOpts", "{", "FloatingIP", ":", "floatingIP", ",", "...
// networkingFloatingIPV2ID retrieves floating IP ID by the provided IP address.
[ "networkingFloatingIPV2ID", "retrieves", "floating", "IP", "ID", "by", "the", "provided", "IP", "address", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/networking_floatingip_v2.go#L18-L41
train
terraform-providers/terraform-provider-openstack
openstack/containerinfra_shared_v1.go
containerInfraClusterV1StateRefreshFunc
func containerInfraClusterV1StateRefreshFunc(client *gophercloud.ServiceClient, clusterID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { c, err := clusters.Get(client, clusterID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return c, "DELETE_C...
go
func containerInfraClusterV1StateRefreshFunc(client *gophercloud.ServiceClient, clusterID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { c, err := clusters.Get(client, clusterID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return c, "DELETE_C...
[ "func", "containerInfraClusterV1StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "clusterID", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",", "string", ",", "er...
// ContainerInfraClusterV1StateRefreshFunc returns a resource.StateRefreshFunc // that is used to watch a container infra Cluster.
[ "ContainerInfraClusterV1StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "a", "container", "infra", "Cluster", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/containerinfra_shared_v1.go#L63-L89
train
terraform-providers/terraform-provider-openstack
openstack/containerinfra_shared_v1.go
containerInfraClusterV1Flavor
func containerInfraClusterV1Flavor(d *schema.ResourceData) (string, error) { if flavor := d.Get("flavor").(string); flavor != "" { return flavor, nil } // Try the OS_MAGNUM_FLAVOR environment variable if v := os.Getenv("OS_MAGNUM_FLAVOR"); v != "" { return v, nil } return "", nil }
go
func containerInfraClusterV1Flavor(d *schema.ResourceData) (string, error) { if flavor := d.Get("flavor").(string); flavor != "" { return flavor, nil } // Try the OS_MAGNUM_FLAVOR environment variable if v := os.Getenv("OS_MAGNUM_FLAVOR"); v != "" { return v, nil } return "", nil }
[ "func", "containerInfraClusterV1Flavor", "(", "d", "*", "schema", ".", "ResourceData", ")", "(", "string", ",", "error", ")", "{", "if", "flavor", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ";", "flavor", "!=", "\"", "\"", ...
// containerInfraClusterV1Flavor will determine the flavor for a container infra // cluster based on either what was set in the configuration or environment // variable.
[ "containerInfraClusterV1Flavor", "will", "determine", "the", "flavor", "for", "a", "container", "infra", "cluster", "based", "on", "either", "what", "was", "set", "in", "the", "configuration", "or", "environment", "variable", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/containerinfra_shared_v1.go#L94-L104
train
terraform-providers/terraform-provider-openstack
openstack/fw_rule_v1.go
ToRuleCreateMap
func (opts RuleCreateOpts) ToRuleCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "firewall_rule") if err != nil { return nil, err } if m := b["firewall_rule"].(map[string]interface{}); m["protocol"] == "any" { m["protocol"] = nil } return b, nil }
go
func (opts RuleCreateOpts) ToRuleCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "firewall_rule") if err != nil { return nil, err } if m := b["firewall_rule"].(map[string]interface{}); m["protocol"] == "any" { m["protocol"] = nil } return b, nil }
[ "func", "(", "opts", "RuleCreateOpts", ")", "ToRuleCreateMap", "(", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "b", ",", "err", ":=", "BuildRequest", "(", "opts", ",", "\"", "\"", ")", "\n", "if", "err", "!=...
// ToRuleCreateMap casts a CreateOpts struct to a map. // It overrides rules.ToRuleCreateMap to add the ValueSpecs field.
[ "ToRuleCreateMap", "casts", "a", "CreateOpts", "struct", "to", "a", "map", ".", "It", "overrides", "rules", ".", "ToRuleCreateMap", "to", "add", "the", "ValueSpecs", "field", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/fw_rule_v1.go#L16-L27
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
getInstanceNetworkInfo
func getInstanceNetworkInfo( d *schema.ResourceData, meta interface{}, queryType, queryTerm string) (map[string]interface{}, error) { config := meta.(*Config) if _, ok := os.LookupEnv("OS_NOVA_NETWORK"); !ok { networkClient, err := config.networkingV2Client(GetRegion(d, config)) if err == nil { networkInfo,...
go
func getInstanceNetworkInfo( d *schema.ResourceData, meta interface{}, queryType, queryTerm string) (map[string]interface{}, error) { config := meta.(*Config) if _, ok := os.LookupEnv("OS_NOVA_NETWORK"); !ok { networkClient, err := config.networkingV2Client(GetRegion(d, config)) if err == nil { networkInfo,...
[ "func", "getInstanceNetworkInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "queryType", ",", "queryTerm", "string", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "config"...
// getInstanceNetworkInfo will query for network information in order to make // an accurate determination of a network's name and a network's ID. // // We will try to first query the Neutron network service and fall back to the // legacy nova-network service if that fails. // // If OS_NOVA_NETWORK is set, query nova-n...
[ "getInstanceNetworkInfo", "will", "query", "for", "network", "information", "in", "order", "to", "make", "an", "accurate", "determination", "of", "a", "network", "s", "name", "and", "a", "network", "s", "ID", ".", "We", "will", "try", "to", "first", "query",...
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L152-L182
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
getInstanceNetworkInfoNovaNet
func getInstanceNetworkInfoNovaNet( client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) { // If somehow a port ended up here, we should just error out. if queryType == "port" { return nil, fmt.Errorf( "Unable to query a port (%s) using the Nova API", queryTerm) } ...
go
func getInstanceNetworkInfoNovaNet( client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) { // If somehow a port ended up here, we should just error out. if queryType == "port" { return nil, fmt.Errorf( "Unable to query a port (%s) using the Nova API", queryTerm) } ...
[ "func", "getInstanceNetworkInfoNovaNet", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "queryType", ",", "queryTerm", "string", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "// If somehow a port ended up here,...
// getInstanceNetworkInfoNovaNet will query the os-tenant-networks API for // the network information.
[ "getInstanceNetworkInfoNovaNet", "will", "query", "the", "os", "-", "tenant", "-", "networks", "API", "for", "the", "network", "information", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L186-L255
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
getInstanceNetworkInfoNeutron
func getInstanceNetworkInfoNeutron( client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) { // If a port was specified, use it to look up the network ID // and then query the network as if a network ID was originally used. if queryType == "port" { listOpts := ports.ListO...
go
func getInstanceNetworkInfoNeutron( client *gophercloud.ServiceClient, queryType, queryTerm string) (map[string]interface{}, error) { // If a port was specified, use it to look up the network ID // and then query the network as if a network ID was originally used. if queryType == "port" { listOpts := ports.ListO...
[ "func", "getInstanceNetworkInfoNeutron", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "queryType", ",", "queryTerm", "string", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "// If a port was specified, use it ...
// getInstanceNetworkInfoNeutron will query the neutron API for the network // information.
[ "getInstanceNetworkInfoNeutron", "will", "query", "the", "neutron", "API", "for", "the", "network", "information", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L259-L330
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
getInstanceAddresses
func getInstanceAddresses(addresses map[string]interface{}) []InstanceAddresses { var allInstanceAddresses []InstanceAddresses for networkName, v := range addresses { instanceAddresses := InstanceAddresses{ NetworkName: networkName, } for _, v := range v.([]interface{}) { instanceNIC := InstanceNIC{} ...
go
func getInstanceAddresses(addresses map[string]interface{}) []InstanceAddresses { var allInstanceAddresses []InstanceAddresses for networkName, v := range addresses { instanceAddresses := InstanceAddresses{ NetworkName: networkName, } for _, v := range v.([]interface{}) { instanceNIC := InstanceNIC{} ...
[ "func", "getInstanceAddresses", "(", "addresses", "map", "[", "string", "]", "interface", "{", "}", ")", "[", "]", "InstanceAddresses", "{", "var", "allInstanceAddresses", "[", "]", "InstanceAddresses", "\n\n", "for", "networkName", ",", "v", ":=", "range", "a...
// getInstanceAddresses parses a Gophercloud server.Server's Address field into // a structured InstanceAddresses struct.
[ "getInstanceAddresses", "parses", "a", "Gophercloud", "server", ".", "Server", "s", "Address", "field", "into", "a", "structured", "InstanceAddresses", "struct", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L334-L386
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
flattenInstanceNetworks
func flattenInstanceNetworks( d *schema.ResourceData, meta interface{}) ([]map[string]interface{}, error) { config := meta.(*Config) computeClient, err := config.computeV2Client(GetRegion(d, config)) if err != nil { return nil, fmt.Errorf("Error creating OpenStack compute client: %s", err) } server, err := se...
go
func flattenInstanceNetworks( d *schema.ResourceData, meta interface{}) ([]map[string]interface{}, error) { config := meta.(*Config) computeClient, err := config.computeV2Client(GetRegion(d, config)) if err != nil { return nil, fmt.Errorf("Error creating OpenStack compute client: %s", err) } server, err := se...
[ "func", "flattenInstanceNetworks", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "config", ":=", "meta", ".", "(", "*", ...
// flattenInstanceNetworks collects instance network information from different // sources and aggregates it all together into a map array.
[ "flattenInstanceNetworks", "collects", "instance", "network", "information", "from", "different", "sources", "and", "aggregates", "it", "all", "together", "into", "a", "map", "array", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L406-L492
train
terraform-providers/terraform-provider-openstack
openstack/compute_instance_v2_networking.go
getInstanceAccessAddresses
func getInstanceAccessAddresses( d *schema.ResourceData, networks []map[string]interface{}) (string, string) { var hostv4, hostv6 string // Loop through all networks // If the network has a valid fixed v4 or fixed v6 address // and hostv4 or hostv6 is not set, set hostv4/hostv6. // If the network is an "access_...
go
func getInstanceAccessAddresses( d *schema.ResourceData, networks []map[string]interface{}) (string, string) { var hostv4, hostv6 string // Loop through all networks // If the network has a valid fixed v4 or fixed v6 address // and hostv4 or hostv6 is not set, set hostv4/hostv6. // If the network is an "access_...
[ "func", "getInstanceAccessAddresses", "(", "d", "*", "schema", ".", "ResourceData", ",", "networks", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "string", ",", "string", ")", "{", "var", "hostv4", ",", "hostv6", "string", "\n\n"...
// getInstanceAccessAddresses determines the best IP address to communicate // with the instance. It does this by looping through all networks and looking // for a valid IP address. Priority is given to a network that was flagged as // an access_network.
[ "getInstanceAccessAddresses", "determines", "the", "best", "IP", "address", "to", "communicate", "with", "the", "instance", ".", "It", "does", "this", "by", "looping", "through", "all", "networks", "and", "looking", "for", "a", "valid", "IP", "address", ".", "...
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/compute_instance_v2_networking.go#L498-L530
train
terraform-providers/terraform-provider-openstack
openstack/types.go
RoundTrip
func (lrt *LogRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) { defer func() { if request.Body != nil { request.Body.Close() } }() // for future reference, this is how to access the Transport struct: //tlsconfig := lrt.Rt.(*http.Transport).TLSClientConfig var err error if lrt.OsDe...
go
func (lrt *LogRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) { defer func() { if request.Body != nil { request.Body.Close() } }() // for future reference, this is how to access the Transport struct: //tlsconfig := lrt.Rt.(*http.Transport).TLSClientConfig var err error if lrt.OsDe...
[ "func", "(", "lrt", "*", "LogRoundTripper", ")", "RoundTrip", "(", "request", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "request", ".", "Body", "!=", "nil", "{...
// RoundTrip performs a round-trip HTTP request and logs relevant information about it.
[ "RoundTrip", "performs", "a", "round", "-", "trip", "HTTP", "request", "and", "logs", "relevant", "information", "about", "it", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/types.go#L35-L87
train
terraform-providers/terraform-provider-openstack
openstack/types.go
logRequest
func (lrt *LogRoundTripper) logRequest(original io.ReadCloser, contentType string) (io.ReadCloser, error) { defer original.Close() var bs bytes.Buffer _, err := io.Copy(&bs, original) if err != nil { return nil, err } // Handle request contentType if strings.HasPrefix(contentType, "application/json") { deb...
go
func (lrt *LogRoundTripper) logRequest(original io.ReadCloser, contentType string) (io.ReadCloser, error) { defer original.Close() var bs bytes.Buffer _, err := io.Copy(&bs, original) if err != nil { return nil, err } // Handle request contentType if strings.HasPrefix(contentType, "application/json") { deb...
[ "func", "(", "lrt", "*", "LogRoundTripper", ")", "logRequest", "(", "original", "io", ".", "ReadCloser", ",", "contentType", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "defer", "original", ".", "Close", "(", ")", "\n\n", "var", ...
// logRequest will log the HTTP Request details. // If the body is JSON, it will attempt to be pretty-formatted.
[ "logRequest", "will", "log", "the", "HTTP", "Request", "details", ".", "If", "the", "body", "is", "JSON", "it", "will", "attempt", "to", "be", "pretty", "-", "formatted", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/types.go#L91-L107
train
terraform-providers/terraform-provider-openstack
openstack/types.go
formatJSON
func (lrt *LogRoundTripper) formatJSON(raw []byte) string { var rawData interface{} err := json.Unmarshal(raw, &rawData) if err != nil { log.Printf("[DEBUG] Unable to parse OpenStack JSON: %s", err) return string(raw) } data, ok := rawData.(map[string]interface{}) if !ok { pretty, err := json.MarshalInden...
go
func (lrt *LogRoundTripper) formatJSON(raw []byte) string { var rawData interface{} err := json.Unmarshal(raw, &rawData) if err != nil { log.Printf("[DEBUG] Unable to parse OpenStack JSON: %s", err) return string(raw) } data, ok := rawData.(map[string]interface{}) if !ok { pretty, err := json.MarshalInden...
[ "func", "(", "lrt", "*", "LogRoundTripper", ")", "formatJSON", "(", "raw", "[", "]", "byte", ")", "string", "{", "var", "rawData", "interface", "{", "}", "\n\n", "err", ":=", "json", ".", "Unmarshal", "(", "raw", ",", "&", "rawData", ")", "\n", "if",...
// formatJSON will try to pretty-format a JSON body. // It will also mask known fields which contain sensitive information.
[ "formatJSON", "will", "try", "to", "pretty", "-", "format", "a", "JSON", "body", ".", "It", "will", "also", "mask", "known", "fields", "which", "contain", "sensitive", "information", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/types.go#L132-L183
train
terraform-providers/terraform-provider-openstack
openstack/types.go
ToSubnetCreateMap
func (opts SubnetCreateOpts) ToSubnetCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "subnet") if err != nil { return nil, err } if m := b["subnet"].(map[string]interface{}); m["gateway_ip"] == "" { m["gateway_ip"] = nil } return b, nil }
go
func (opts SubnetCreateOpts) ToSubnetCreateMap() (map[string]interface{}, error) { b, err := BuildRequest(opts, "subnet") if err != nil { return nil, err } if m := b["subnet"].(map[string]interface{}); m["gateway_ip"] == "" { m["gateway_ip"] = nil } return b, nil }
[ "func", "(", "opts", "SubnetCreateOpts", ")", "ToSubnetCreateMap", "(", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "b", ",", "err", ":=", "BuildRequest", "(", "opts", ",", "\"", "\"", ")", "\n", "if", "err", ...
// ToSubnetCreateMap casts a CreateOpts struct to a map. // It overrides subnets.ToSubnetCreateMap to add the ValueSpecs field.
[ "ToSubnetCreateMap", "casts", "a", "CreateOpts", "struct", "to", "a", "map", ".", "It", "overrides", "subnets", ".", "ToSubnetCreateMap", "to", "add", "the", "ValueSpecs", "field", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/types.go#L253-L264
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_endpoint_v3.go
dataSourceIdentityEndpointV3Read
func dataSourceIdentityEndpointV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } availability := gophercloud.AvailabilityP...
go
func dataSourceIdentityEndpointV3Read(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) identityClient, err := config.identityV3Client(GetRegion(d, config)) if err != nil { return fmt.Errorf("Error creating OpenStack identity client: %s", err) } availability := gophercloud.AvailabilityP...
[ "func", "dataSourceIdentityEndpointV3Read", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "error", "{", "config", ":=", "meta", ".", "(", "*", "Config", ")", "\n", "identityClient", ",", "err", ":=", "config", ".", ...
// dataSourceIdentityEndpointV3Read performs the endpoint lookup.
[ "dataSourceIdentityEndpointV3Read", "performs", "the", "endpoint", "lookup", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_endpoint_v3.go#L57-L130
train
terraform-providers/terraform-provider-openstack
openstack/data_source_openstack_identity_endpoint_v3.go
dataSourceIdentityEndpointV3Attributes
func dataSourceIdentityEndpointV3Attributes(d *schema.ResourceData, endpoint *endpoints.Endpoint) error { log.Printf("[DEBUG] openstack_identity_endpoint_v3 details: %#v", endpoint) d.SetId(endpoint.ID) d.Set("interface", endpoint.Availability) d.Set("region", endpoint.Region) d.Set("service_id", endpoint.Service...
go
func dataSourceIdentityEndpointV3Attributes(d *schema.ResourceData, endpoint *endpoints.Endpoint) error { log.Printf("[DEBUG] openstack_identity_endpoint_v3 details: %#v", endpoint) d.SetId(endpoint.ID) d.Set("interface", endpoint.Availability) d.Set("region", endpoint.Region) d.Set("service_id", endpoint.Service...
[ "func", "dataSourceIdentityEndpointV3Attributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "endpoint", "*", "endpoints", ".", "Endpoint", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "endpoint", ")", "\n\n", "d", ".", "SetId", "...
// dataSourceIdentityEndpointV3Attributes populates the fields of an Endpoint resource.
[ "dataSourceIdentityEndpointV3Attributes", "populates", "the", "fields", "of", "an", "Endpoint", "resource", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/data_source_openstack_identity_endpoint_v3.go#L133-L144
train
terraform-providers/terraform-provider-openstack
openstack/db_instance_v1.go
databaseInstanceV1StateRefreshFunc
func databaseInstanceV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { i, err := instances.Get(client, instanceID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return i, "DELETED", ...
go
func databaseInstanceV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { i, err := instances.Get(client, instanceID).Extract() if err != nil { if _, ok := err.(gophercloud.ErrDefault404); ok { return i, "DELETED", ...
[ "func", "databaseInstanceV1StateRefreshFunc", "(", "client", "*", "gophercloud", ".", "ServiceClient", ",", "instanceID", "string", ")", "resource", ".", "StateRefreshFunc", "{", "return", "func", "(", ")", "(", "interface", "{", "}", ",", "string", ",", "error"...
// databaseInstanceV1StateRefreshFunc returns a resource.StateRefreshFunc // that is used to watch a database instance.
[ "databaseInstanceV1StateRefreshFunc", "returns", "a", "resource", ".", "StateRefreshFunc", "that", "is", "used", "to", "watch", "a", "database", "instance", "." ]
a4c13eee81a7ca8682741b049cb067610bdf45b2
https://github.com/terraform-providers/terraform-provider-openstack/blob/a4c13eee81a7ca8682741b049cb067610bdf45b2/openstack/db_instance_v1.go#L71-L87
train
hashicorp/raft-boltdb
bolt_store.go
New
func New(options Options) (*BoltStore, error) { // Try to connect handle, err := bolt.Open(options.Path, dbFileMode, options.BoltOptions) if err != nil { return nil, err } handle.NoSync = options.NoSync // Create the new store store := &BoltStore{ conn: handle, path: options.Path, } // If the store was...
go
func New(options Options) (*BoltStore, error) { // Try to connect handle, err := bolt.Open(options.Path, dbFileMode, options.BoltOptions) if err != nil { return nil, err } handle.NoSync = options.NoSync // Create the new store store := &BoltStore{ conn: handle, path: options.Path, } // If the store was...
[ "func", "New", "(", "options", "Options", ")", "(", "*", "BoltStore", ",", "error", ")", "{", "// Try to connect", "handle", ",", "err", ":=", "bolt", ".", "Open", "(", "options", ".", "Path", ",", "dbFileMode", ",", "options", ".", "BoltOptions", ")", ...
// New uses the supplied options to open the BoltDB and prepare it for use as a raft backend.
[ "New", "uses", "the", "supplied", "options", "to", "open", "the", "BoltDB", "and", "prepare", "it", "for", "use", "as", "a", "raft", "backend", "." ]
6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3
https://github.com/hashicorp/raft-boltdb/blob/6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3/bolt_store.go#L64-L87
train
hashicorp/raft-boltdb
bolt_store.go
initialize
func (b *BoltStore) initialize() error { tx, err := b.conn.Begin(true) if err != nil { return err } defer tx.Rollback() // Create all the buckets if _, err := tx.CreateBucketIfNotExists(dbLogs); err != nil { return err } if _, err := tx.CreateBucketIfNotExists(dbConf); err != nil { return err } return...
go
func (b *BoltStore) initialize() error { tx, err := b.conn.Begin(true) if err != nil { return err } defer tx.Rollback() // Create all the buckets if _, err := tx.CreateBucketIfNotExists(dbLogs); err != nil { return err } if _, err := tx.CreateBucketIfNotExists(dbConf); err != nil { return err } return...
[ "func", "(", "b", "*", "BoltStore", ")", "initialize", "(", ")", "error", "{", "tx", ",", "err", ":=", "b", ".", "conn", ".", "Begin", "(", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "tx", ".", ...
// initialize is used to set up all of the buckets.
[ "initialize", "is", "used", "to", "set", "up", "all", "of", "the", "buckets", "." ]
6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3
https://github.com/hashicorp/raft-boltdb/blob/6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3/bolt_store.go#L90-L106
train
hashicorp/raft-boltdb
bolt_store.go
GetLog
func (b *BoltStore) GetLog(idx uint64, log *raft.Log) error { tx, err := b.conn.Begin(false) if err != nil { return err } defer tx.Rollback() bucket := tx.Bucket(dbLogs) val := bucket.Get(uint64ToBytes(idx)) if val == nil { return raft.ErrLogNotFound } return decodeMsgPack(val, log) }
go
func (b *BoltStore) GetLog(idx uint64, log *raft.Log) error { tx, err := b.conn.Begin(false) if err != nil { return err } defer tx.Rollback() bucket := tx.Bucket(dbLogs) val := bucket.Get(uint64ToBytes(idx)) if val == nil { return raft.ErrLogNotFound } return decodeMsgPack(val, log) }
[ "func", "(", "b", "*", "BoltStore", ")", "GetLog", "(", "idx", "uint64", ",", "log", "*", "raft", ".", "Log", ")", "error", "{", "tx", ",", "err", ":=", "b", ".", "conn", ".", "Begin", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "...
// GetLog is used to retrieve a log from BoltDB at a given index.
[ "GetLog", "is", "used", "to", "retrieve", "a", "log", "from", "BoltDB", "at", "a", "given", "index", "." ]
6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3
https://github.com/hashicorp/raft-boltdb/blob/6e5ba93211eaf8d9a2ad7e41ffad8c6f160f9fe3/bolt_store.go#L146-L160
train
mailgun/mailgun-go
domains.go
ListDomains
func (mg *MailgunImpl) ListDomains(opts *ListOptions) *DomainsIterator { var limit int if opts != nil { limit = opts.Limit } if limit == 0 { limit = 100 } return &DomainsIterator{ mg: mg, url: generatePublicApiUrl(mg, domainsEndpoint), domainsListResponse: domainsListRe...
go
func (mg *MailgunImpl) ListDomains(opts *ListOptions) *DomainsIterator { var limit int if opts != nil { limit = opts.Limit } if limit == 0 { limit = 100 } return &DomainsIterator{ mg: mg, url: generatePublicApiUrl(mg, domainsEndpoint), domainsListResponse: domainsListRe...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListDomains", "(", "opts", "*", "ListOptions", ")", "*", "DomainsIterator", "{", "var", "limit", "int", "\n", "if", "opts", "!=", "nil", "{", "limit", "=", "opts", ".", "Limit", "\n", "}", "\n\n", "if", "l...
// ListDomains retrieves a set of domains from Mailgun.
[ "ListDomains", "retrieves", "a", "set", "of", "domains", "from", "Mailgun", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L83-L98
train
mailgun/mailgun-go
domains.go
GetDomain
func (mg *MailgunImpl) GetDomain(ctx context.Context, domain string) (DomainResponse, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp DomainResponse err := getResponseFromJSON(ctx, r, &resp) return ...
go
func (mg *MailgunImpl) GetDomain(ctx context.Context, domain string) (DomainResponse, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp DomainResponse err := getResponseFromJSON(ctx, r, &resp) return ...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetDomain", "(", "ctx", "context", ".", "Context", ",", "domain", "string", ")", "(", "DomainResponse", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "domainsE...
// GetDomain retrieves detailed information about the named domain.
[ "GetDomain", "retrieves", "detailed", "information", "about", "the", "named", "domain", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L235-L242
train
mailgun/mailgun-go
domains.go
CreateDomain
func (mg *MailgunImpl) CreateDomain(ctx context.Context, name string, opts *CreateDomainOptions) (DomainResponse, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() payload.addValue("name", n...
go
func (mg *MailgunImpl) CreateDomain(ctx context.Context, name string, opts *CreateDomainOptions) (DomainResponse, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() payload.addValue("name", n...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "CreateDomain", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "opts", "*", "CreateDomainOptions", ")", "(", "DomainResponse", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "genera...
// CreateDomain instructs Mailgun to create a new domain for your account. // The name parameter identifies the domain. // The smtpPassword parameter provides an access credential for the domain. // The spamAction domain must be one of Delete, Tag, or Disabled. // The wildcard parameter instructs Mailgun to treat all s...
[ "CreateDomain", "instructs", "Mailgun", "to", "create", "a", "new", "domain", "for", "your", "account", ".", "The", "name", "parameter", "identifies", "the", "domain", ".", "The", "smtpPassword", "parameter", "provides", "an", "access", "credential", "for", "the...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L271-L302
train
mailgun/mailgun-go
domains.go
GetDomainConnection
func (mg *MailgunImpl) GetDomainConnection(ctx context.Context, domain string) (DomainConnection, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/connection") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp domainConnectionResponse err := getRe...
go
func (mg *MailgunImpl) GetDomainConnection(ctx context.Context, domain string) (DomainConnection, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/connection") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp domainConnectionResponse err := getRe...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetDomainConnection", "(", "ctx", "context", ".", "Context", ",", "domain", "string", ")", "(", "DomainConnection", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",",...
// GetDomainConnection returns delivery connection settings for the defined domain
[ "GetDomainConnection", "returns", "delivery", "connection", "settings", "for", "the", "defined", "domain" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L305-L312
train
mailgun/mailgun-go
domains.go
UpdateDomainConnection
func (mg *MailgunImpl) UpdateDomainConnection(ctx context.Context, domain string, settings DomainConnection) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/connection") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() p...
go
func (mg *MailgunImpl) UpdateDomainConnection(ctx context.Context, domain string, settings DomainConnection) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/connection") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() p...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "UpdateDomainConnection", "(", "ctx", "context", ".", "Context", ",", "domain", "string", ",", "settings", "DomainConnection", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", "...
// Updates the specified delivery connection settings for the defined domain
[ "Updates", "the", "specified", "delivery", "connection", "settings", "for", "the", "defined", "domain" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L315-L325
train
mailgun/mailgun-go
domains.go
DeleteDomain
func (mg *MailgunImpl) DeleteDomain(ctx context.Context, name string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + name) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteDomain(ctx context.Context, name string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + name) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteDomain", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "domainsEndpoint", ")", "+", "\"", "\"", ...
// DeleteDomain instructs Mailgun to dispose of the named domain name
[ "DeleteDomain", "instructs", "Mailgun", "to", "dispose", "of", "the", "named", "domain", "name" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L328-L334
train
mailgun/mailgun-go
domains.go
GetDomainTracking
func (mg *MailgunImpl) GetDomainTracking(ctx context.Context, domain string) (DomainTracking, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/tracking") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp domainTrackingResponse err := getResponseFr...
go
func (mg *MailgunImpl) GetDomainTracking(ctx context.Context, domain string) (DomainTracking, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + domain + "/tracking") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp domainTrackingResponse err := getResponseFr...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetDomainTracking", "(", "ctx", "context", ".", "Context", ",", "domain", "string", ")", "(", "DomainTracking", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "...
// GetDomainTracking returns tracking settings for a domain
[ "GetDomainTracking", "returns", "tracking", "settings", "for", "a", "domain" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/domains.go#L337-L344
train
mailgun/mailgun-go
webhooks.go
ListWebhooks
func (mg *MailgunImpl) ListWebhooks(ctx context.Context) (map[string]string, error) { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Webhooks map[string]interface{} `json:"webhooks"` } err := getResponseFr...
go
func (mg *MailgunImpl) ListWebhooks(ctx context.Context) (map[string]string, error) { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Webhooks map[string]interface{} `json:"webhooks"` } err := getResponseFr...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListWebhooks", "(", "ctx", "context", ".", "Context", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateDomainApiUrl", "(", "mg", ",", "webhooksE...
// ListWebhooks returns the complete set of webhooks configured for your domain. // Note that a zero-length mapping is not an error.
[ "ListWebhooks", "returns", "the", "complete", "set", "of", "webhooks", "configured", "for", "your", "domain", ".", "Note", "that", "a", "zero", "-", "length", "mapping", "is", "not", "an", "error", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/webhooks.go#L17-L35
train
mailgun/mailgun-go
webhooks.go
DeleteWebhook
func (mg *MailgunImpl) DeleteWebhook(ctx context.Context, t string) error { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteWebhook(ctx context.Context, t string) error { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteWebhook", "(", "ctx", "context", ".", "Context", ",", "t", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateDomainApiUrl", "(", "mg", ",", "webhooksEndpoint", ")", "+", "\"", "\"", ...
// DeleteWebhook removes the specified webhook from your domain's configuration.
[ "DeleteWebhook", "removes", "the", "specified", "webhook", "from", "your", "domain", "s", "configuration", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/webhooks.go#L52-L58
train
mailgun/mailgun-go
webhooks.go
GetWebhook
func (mg *MailgunImpl) GetWebhook(ctx context.Context, t string) (string, error) { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Webhook struct { Url string `json:"url"` } `json:"webhook"` }...
go
func (mg *MailgunImpl) GetWebhook(ctx context.Context, t string) (string, error) { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Webhook struct { Url string `json:"url"` } `json:"webhook"` }...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetWebhook", "(", "ctx", "context", ".", "Context", ",", "t", "string", ")", "(", "string", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateDomainApiUrl", "(", "mg", ",", "webhooksEndpoint", ...
// GetWebhook retrieves the currently assigned webhook URL associated with the provided type of webhook.
[ "GetWebhook", "retrieves", "the", "currently", "assigned", "webhook", "URL", "associated", "with", "the", "provided", "type", "of", "webhook", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/webhooks.go#L61-L72
train
mailgun/mailgun-go
webhooks.go
UpdateWebhook
func (mg *MailgunImpl) UpdateWebhook(ctx context.Context, t string, urls []string) error { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() for _, url := range urls { p.addValue("url", url) }...
go
func (mg *MailgunImpl) UpdateWebhook(ctx context.Context, t string, urls []string) error { r := newHTTPRequest(generateDomainApiUrl(mg, webhooksEndpoint) + "/" + t) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() for _, url := range urls { p.addValue("url", url) }...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "UpdateWebhook", "(", "ctx", "context", ".", "Context", ",", "t", "string", ",", "urls", "[", "]", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateDomainApiUrl", "(", "mg", ",", "webhook...
// UpdateWebhook replaces one webhook setting for another.
[ "UpdateWebhook", "replaces", "one", "webhook", "setting", "for", "another", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/webhooks.go#L75-L85
train
mailgun/mailgun-go
webhooks.go
VerifyWebhookSignature
func (mg *MailgunImpl) VerifyWebhookSignature(sig Signature) (verified bool, err error) { h := hmac.New(sha256.New, []byte(mg.APIKey())) io.WriteString(h, sig.TimeStamp) io.WriteString(h, sig.Token) calculatedSignature := h.Sum(nil) signature, err := hex.DecodeString(sig.Signature) if err != nil { return false...
go
func (mg *MailgunImpl) VerifyWebhookSignature(sig Signature) (verified bool, err error) { h := hmac.New(sha256.New, []byte(mg.APIKey())) io.WriteString(h, sig.TimeStamp) io.WriteString(h, sig.Token) calculatedSignature := h.Sum(nil) signature, err := hex.DecodeString(sig.Signature) if err != nil { return false...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "VerifyWebhookSignature", "(", "sig", "Signature", ")", "(", "verified", "bool", ",", "err", "error", ")", "{", "h", ":=", "hmac", ".", "New", "(", "sha256", ".", "New", ",", "[", "]", "byte", "(", "mg", ...
// Use this method to parse the webhook signature given as JSON in the webhook response
[ "Use", "this", "method", "to", "parse", "the", "webhook", "signature", "given", "as", "JSON", "in", "the", "webhook", "response" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/webhooks.go#L101-L116
train
mailgun/mailgun-go
rest_shim.go
newError
func newError(url string, expected []int, got *httpResponse) error { return &UnexpectedResponseError{ URL: url, Expected: expected, Actual: got.Code, Data: got.Data, } }
go
func newError(url string, expected []int, got *httpResponse) error { return &UnexpectedResponseError{ URL: url, Expected: expected, Actual: got.Code, Data: got.Data, } }
[ "func", "newError", "(", "url", "string", ",", "expected", "[", "]", "int", ",", "got", "*", "httpResponse", ")", "error", "{", "return", "&", "UnexpectedResponseError", "{", "URL", ":", "url", ",", "Expected", ":", "expected", ",", "Actual", ":", "got",...
// newError creates a new error condition to be returned.
[ "newError", "creates", "a", "new", "error", "condition", "to", "be", "returned", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/rest_shim.go#L35-L42
train
mailgun/mailgun-go
rest_shim.go
makeRequest
func makeRequest(ctx context.Context, r *httpRequest, method string, p payload) (*httpResponse, error) { r.addHeader("User-Agent", MailgunGoUserAgent) rsp, err := r.makeRequest(ctx, method, p) if (err == nil) && notGood(rsp.Code, expected) { return rsp, newError(r.URL, expected, rsp) } return rsp, err }
go
func makeRequest(ctx context.Context, r *httpRequest, method string, p payload) (*httpResponse, error) { r.addHeader("User-Agent", MailgunGoUserAgent) rsp, err := r.makeRequest(ctx, method, p) if (err == nil) && notGood(rsp.Code, expected) { return rsp, newError(r.URL, expected, rsp) } return rsp, err }
[ "func", "makeRequest", "(", "ctx", "context", ".", "Context", ",", "r", "*", "httpRequest", ",", "method", "string", ",", "p", "payload", ")", "(", "*", "httpResponse", ",", "error", ")", "{", "r", ".", "addHeader", "(", "\"", "\"", ",", "MailgunGoUser...
// makeRequest shim performs a generic request, checking for a positive outcome. // See simplehttp.MakeRequest for more details.
[ "makeRequest", "shim", "performs", "a", "generic", "request", "checking", "for", "a", "positive", "outcome", ".", "See", "simplehttp", ".", "MakeRequest", "for", "more", "details", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/rest_shim.go#L61-L68
train
mailgun/mailgun-go
rest_shim.go
getResponseFromJSON
func getResponseFromJSON(ctx context.Context, r *httpRequest, v interface{}) error { r.addHeader("User-Agent", MailgunGoUserAgent) response, err := r.makeGetRequest(ctx) if err != nil { return err } if notGood(response.Code, expected) { return newError(r.URL, expected, response) } return response.parseFromJS...
go
func getResponseFromJSON(ctx context.Context, r *httpRequest, v interface{}) error { r.addHeader("User-Agent", MailgunGoUserAgent) response, err := r.makeGetRequest(ctx) if err != nil { return err } if notGood(response.Code, expected) { return newError(r.URL, expected, response) } return response.parseFromJS...
[ "func", "getResponseFromJSON", "(", "ctx", "context", ".", "Context", ",", "r", "*", "httpRequest", ",", "v", "interface", "{", "}", ")", "error", "{", "r", ".", "addHeader", "(", "\"", "\"", ",", "MailgunGoUserAgent", ")", "\n", "response", ",", "err", ...
// getResponseFromJSON shim performs a GET request, checking for a positive outcome. // See simplehttp.GetResponseFromJSON for more details.
[ "getResponseFromJSON", "shim", "performs", "a", "GET", "request", "checking", "for", "a", "positive", "outcome", ".", "See", "simplehttp", ".", "GetResponseFromJSON", "for", "more", "details", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/rest_shim.go#L72-L82
train
mailgun/mailgun-go
rest_shim.go
postResponseFromJSON
func postResponseFromJSON(ctx context.Context, r *httpRequest, p payload, v interface{}) error { r.addHeader("User-Agent", MailgunGoUserAgent) response, err := r.makePostRequest(ctx, p) if err != nil { return err } if notGood(response.Code, expected) { return newError(r.URL, expected, response) } return resp...
go
func postResponseFromJSON(ctx context.Context, r *httpRequest, p payload, v interface{}) error { r.addHeader("User-Agent", MailgunGoUserAgent) response, err := r.makePostRequest(ctx, p) if err != nil { return err } if notGood(response.Code, expected) { return newError(r.URL, expected, response) } return resp...
[ "func", "postResponseFromJSON", "(", "ctx", "context", ".", "Context", ",", "r", "*", "httpRequest", ",", "p", "payload", ",", "v", "interface", "{", "}", ")", "error", "{", "r", ".", "addHeader", "(", "\"", "\"", ",", "MailgunGoUserAgent", ")", "\n", ...
// postResponseFromJSON shim performs a POST request, checking for a positive outcome. // See simplehttp.PostResponseFromJSON for more details.
[ "postResponseFromJSON", "shim", "performs", "a", "POST", "request", "checking", "for", "a", "positive", "outcome", ".", "See", "simplehttp", ".", "PostResponseFromJSON", "for", "more", "details", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/rest_shim.go#L86-L96
train
mailgun/mailgun-go
rest_shim.go
GetStatusFromErr
func GetStatusFromErr(err error) int { obj, ok := err.(*UnexpectedResponseError) if !ok { return -1 } return obj.Actual }
go
func GetStatusFromErr(err error) int { obj, ok := err.(*UnexpectedResponseError) if !ok { return -1 } return obj.Actual }
[ "func", "GetStatusFromErr", "(", "err", "error", ")", "int", "{", "obj", ",", "ok", ":=", "err", ".", "(", "*", "UnexpectedResponseError", ")", "\n", "if", "!", "ok", "{", "return", "-", "1", "\n", "}", "\n", "return", "obj", ".", "Actual", "\n", "...
// Extract the http status code from error object
[ "Extract", "the", "http", "status", "code", "from", "error", "object" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/rest_shim.go#L157-L163
train
mailgun/mailgun-go
ips.go
ListIPS
func (mg *MailgunImpl) ListIPS(ctx context.Context, dedicated bool) ([]IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint)) r.setClient(mg.Client()) if dedicated { r.addParameter("dedicated", "true") } r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp ipAddressListResponse if err :...
go
func (mg *MailgunImpl) ListIPS(ctx context.Context, dedicated bool) ([]IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint)) r.setClient(mg.Client()) if dedicated { r.addParameter("dedicated", "true") } r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp ipAddressListResponse if err :...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListIPS", "(", "ctx", "context", ".", "Context", ",", "dedicated", "bool", ")", "(", "[", "]", "IPAddress", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "...
// ListIPS returns a list of IPs assigned to your account
[ "ListIPS", "returns", "a", "list", "of", "IPs", "assigned", "to", "your", "account" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L22-L39
train
mailgun/mailgun-go
ips.go
GetIP
func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint) + "/" + ip) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp IPAddress err := getResponseFromJSON(ctx, r, &resp) return resp, err }
go
func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint) + "/" + ip) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp IPAddress err := getResponseFromJSON(ctx, r, &resp) return resp, err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetIP", "(", "ctx", "context", ".", "Context", ",", "ip", "string", ")", "(", "IPAddress", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "ipsEndpoint", ")", ...
// GetIP returns information about the specified IP
[ "GetIP", "returns", "information", "about", "the", "specified", "IP" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L42-L49
train
mailgun/mailgun-go
ips.go
ListDomainIPS
func (mg *MailgunImpl) ListDomainIPS(ctx context.Context) ([]IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp ipAddressListResponse if err := getResponseFromJSON(ctx, r, &resp)...
go
func (mg *MailgunImpl) ListDomainIPS(ctx context.Context) ([]IPAddress, error) { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp ipAddressListResponse if err := getResponseFromJSON(ctx, r, &resp)...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListDomainIPS", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "IPAddress", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "domainsEndpoint", ")", ...
// ListDomainIPS returns a list of IPs currently assigned to the specified domain.
[ "ListDomainIPS", "returns", "a", "list", "of", "IPs", "currently", "assigned", "to", "the", "specified", "domain", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L52-L66
train
mailgun/mailgun-go
ips.go
AddDomainIP
func (mg *MailgunImpl) AddDomainIP(ctx context.Context, ip string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() payload.addValue("ip", ip) _, err := makePostR...
go
func (mg *MailgunImpl) AddDomainIP(ctx context.Context, ip string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() payload.addValue("ip", ip) _, err := makePostR...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "AddDomainIP", "(", "ctx", "context", ".", "Context", ",", "ip", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "domainsEndpoint", ")", "+", "\"", "\"", "...
// Assign a dedicated IP to the domain specified.
[ "Assign", "a", "dedicated", "IP", "to", "the", "domain", "specified", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L69-L78
train
mailgun/mailgun-go
ips.go
DeleteDomainIP
func (mg *MailgunImpl) DeleteDomainIP(ctx context.Context, ip string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips/" + ip) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteDomainIP(ctx context.Context, ip string) error { r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips/" + ip) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteDomainIP", "(", "ctx", "context", ".", "Context", ",", "ip", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "domainsEndpoint", ")", "+", "\"", "\"", ...
// Unassign an IP from the domain specified.
[ "Unassign", "an", "IP", "from", "the", "domain", "specified", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L81-L87
train
mailgun/mailgun-go
credentials.go
CreateCredential
func (mg *MailgunImpl) CreateCredential(ctx context.Context, login, password string) error { if (login == "") || (password == "") { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, "")) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addVal...
go
func (mg *MailgunImpl) CreateCredential(ctx context.Context, login, password string) error { if (login == "") || (password == "") { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, "")) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addVal...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "CreateCredential", "(", "ctx", "context", ".", "Context", ",", "login", ",", "password", "string", ")", "error", "{", "if", "(", "login", "==", "\"", "\"", ")", "||", "(", "password", "==", "\"", "\"", ")"...
// CreateCredential attempts to create associate a new principle with your domain.
[ "CreateCredential", "attempts", "to", "create", "associate", "a", "new", "principle", "with", "your", "domain", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L178-L190
train
mailgun/mailgun-go
credentials.go
ChangeCredentialPassword
func (mg *MailgunImpl) ChangeCredentialPassword(ctx context.Context, id, password string) error { if (id == "") || (password == "") { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, id)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addV...
go
func (mg *MailgunImpl) ChangeCredentialPassword(ctx context.Context, id, password string) error { if (id == "") || (password == "") { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, id)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addV...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ChangeCredentialPassword", "(", "ctx", "context", ".", "Context", ",", "id", ",", "password", "string", ")", "error", "{", "if", "(", "id", "==", "\"", "\"", ")", "||", "(", "password", "==", "\"", "\"", "...
// ChangeCredentialPassword attempts to alter the indicated credential's password.
[ "ChangeCredentialPassword", "attempts", "to", "alter", "the", "indicated", "credential", "s", "password", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L193-L204
train
mailgun/mailgun-go
credentials.go
DeleteCredential
func (mg *MailgunImpl) DeleteCredential(ctx context.Context, id string) error { if id == "" { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, id)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteCredential(ctx context.Context, id string) error { if id == "" { return ErrEmptyParam } r := newHTTPRequest(generateCredentialsUrl(mg, id)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteCredential", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "if", "id", "==", "\"", "\"", "{", "return", "ErrEmptyParam", "\n", "}", "\n", "r", ":=", "newHTTPRequest", "...
// DeleteCredential attempts to remove the indicated principle from the domain.
[ "DeleteCredential", "attempts", "to", "remove", "the", "indicated", "principle", "from", "the", "domain", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L207-L216
train
mailgun/mailgun-go
template_versions.go
AddTemplateVersion
func (mg *MailgunImpl) AddTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() ...
go
func (mg *MailgunImpl) AddTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) payload := newUrlEncodedPayload() ...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "AddTemplateVersion", "(", "ctx", "context", ".", "Context", ",", "templateName", "string", ",", "version", "*", "TemplateVersion", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg", ...
// AddTemplateVersion adds a template version to a template
[ "AddTemplateVersion", "adds", "a", "template", "version", "to", "a", "template" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L26-L53
train
mailgun/mailgun-go
template_versions.go
GetTemplateVersion
func (mg *MailgunImpl) GetTemplateVersion(ctx context.Context, templateName, tag string) (TemplateVersion, error) { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp templateResp err := ...
go
func (mg *MailgunImpl) GetTemplateVersion(ctx context.Context, templateName, tag string) (TemplateVersion, error) { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var resp templateResp err := ...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetTemplateVersion", "(", "ctx", "context", ".", "Context", ",", "templateName", ",", "tag", "string", ")", "(", "TemplateVersion", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", ...
// GetTemplateVersion gets a specific version of a template
[ "GetTemplateVersion", "gets", "a", "specific", "version", "of", "a", "template" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L56-L67
train
mailgun/mailgun-go
template_versions.go
UpdateTemplateVersion
func (mg *MailgunImpl) UpdateTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + version.Tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncoded...
go
func (mg *MailgunImpl) UpdateTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + version.Tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncoded...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "UpdateTemplateVersion", "(", "ctx", "context", ".", "Context", ",", "templateName", "string", ",", "version", "*", "TemplateVersion", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg",...
// Update the comment and mark a version of a template active
[ "Update", "the", "comment", "and", "mark", "a", "version", "of", "a", "template", "active" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L70-L90
train
mailgun/mailgun-go
template_versions.go
DeleteTemplateVersion
func (mg *MailgunImpl) DeleteTemplateVersion(ctx context.Context, templateName, tag string) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err...
go
func (mg *MailgunImpl) DeleteTemplateVersion(ctx context.Context, templateName, tag string) error { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteTemplateVersion", "(", "ctx", "context", ".", "Context", ",", "templateName", ",", "tag", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg", ",", "templatesEndpoint", ...
// Delete a specific version of a template
[ "Delete", "a", "specific", "version", "of", "a", "template" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L93-L99
train
mailgun/mailgun-go
template_versions.go
ListTemplateVersions
func (mg *MailgunImpl) ListTemplateVersions(templateName string, opts *ListOptions) *TemplateVersionsIterator { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) if opts != nil { if opts.Limit != 0 { ...
go
func (mg *MailgunImpl) ListTemplateVersions(templateName string, opts *ListOptions) *TemplateVersionsIterator { r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions") r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) if opts != nil { if opts.Limit != 0 { ...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListTemplateVersions", "(", "templateName", "string", ",", "opts", "*", "ListOptions", ")", "*", "TemplateVersionsIterator", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg", ",", "templatesEndpoint", ...
// List all the versions of a specific template
[ "List", "all", "the", "versions", "of", "a", "specific", "template" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L108-L123
train
mailgun/mailgun-go
routes.go
ListRoutes
func (mg *MailgunImpl) ListRoutes(opts *ListOptions) *RoutesIterator { var limit int if opts != nil { limit = opts.Limit } if limit == 0 { limit = 100 } return &RoutesIterator{ mg: mg, url: generatePublicApiUrl(mg, routesEndpoint), routesListResponse: routesListResponse{...
go
func (mg *MailgunImpl) ListRoutes(opts *ListOptions) *RoutesIterator { var limit int if opts != nil { limit = opts.Limit } if limit == 0 { limit = 100 } return &RoutesIterator{ mg: mg, url: generatePublicApiUrl(mg, routesEndpoint), routesListResponse: routesListResponse{...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListRoutes", "(", "opts", "*", "ListOptions", ")", "*", "RoutesIterator", "{", "var", "limit", "int", "\n", "if", "opts", "!=", "nil", "{", "limit", "=", "opts", ".", "Limit", "\n", "}", "\n\n", "if", "lim...
// ListRoutes allows you to iterate through a list of routes returned by the API
[ "ListRoutes", "allows", "you", "to", "iterate", "through", "a", "list", "of", "routes", "returned", "by", "the", "API" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L43-L59
train
mailgun/mailgun-go
routes.go
CreateRoute
func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addValue("priority", strconv.Itoa(prototype.Priority...
go
func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() p.addValue("priority", strconv.Itoa(prototype.Priority...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "CreateRoute", "(", "ctx", "context", ".", "Context", ",", "prototype", "Route", ")", "(", "_ignored", "Route", ",", "err", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ...
// CreateRoute installs a new route for your domain. // The route structure you provide serves as a template, and // only a subset of the fields influence the operation. // See the Route structure definition for more details.
[ "CreateRoute", "installs", "a", "new", "route", "for", "your", "domain", ".", "The", "route", "structure", "you", "provide", "serves", "as", "a", "template", "and", "only", "a", "subset", "of", "the", "fields", "influence", "the", "operation", ".", "See", ...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L199-L215
train
mailgun/mailgun-go
routes.go
DeleteRoute
func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteRoute", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "routesEndpoint", ")", "+", "\"", "\"", "+...
// DeleteRoute removes the specified route from your domain's configuration. // To avoid ambiguity, Mailgun identifies the route by unique ID. // See the Route structure definition and the Mailgun API documentation for more details.
[ "DeleteRoute", "removes", "the", "specified", "route", "from", "your", "domain", "s", "configuration", ".", "To", "avoid", "ambiguity", "Mailgun", "identifies", "the", "route", "by", "unique", "ID", ".", "See", "the", "Route", "structure", "definition", "and", ...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L220-L226
train
mailgun/mailgun-go
routes.go
GetRoute
func (mg *MailgunImpl) GetRoute(ctx context.Context, id string) (Route, error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Message string `json:"message"` *Route `json:"route"` } err := ge...
go
func (mg *MailgunImpl) GetRoute(ctx context.Context, id string) (Route, error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var envelope struct { Message string `json:"message"` *Route `json:"route"` } err := ge...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetRoute", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "Route", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ",", "routesEndpoint", ")"...
// GetRoute retrieves the complete route definition associated with the unique route ID.
[ "GetRoute", "retrieves", "the", "complete", "route", "definition", "associated", "with", "the", "unique", "route", "ID", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L229-L243
train
mailgun/mailgun-go
routes.go
UpdateRoute
func (mg *MailgunImpl) UpdateRoute(ctx context.Context, id string, route Route) (Route, error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() if route.Priority != 0 { p.addValue("priority",...
go
func (mg *MailgunImpl) UpdateRoute(ctx context.Context, id string, route Route) (Route, error) { r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newUrlEncodedPayload() if route.Priority != 0 { p.addValue("priority",...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "UpdateRoute", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "route", "Route", ")", "(", "Route", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generatePublicApiUrl", "(", "mg", ...
// UpdateRoute provides an "in-place" update of the specified route. // Only those route fields which are non-zero or non-empty are updated. // All other fields remain as-is.
[ "UpdateRoute", "provides", "an", "in", "-", "place", "update", "of", "the", "specified", "route", ".", "Only", "those", "route", "fields", "which", "are", "non", "-", "zero", "or", "non", "-", "empty", "are", "updated", ".", "All", "other", "fields", "re...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L248-L272
train
mailgun/mailgun-go
members.go
GetMember
func (mg *MailgunImpl) GetMember(ctx context.Context, s, l string) (Member, error) { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) response, err := makeGetRequest(ctx, r) if err != nil { return Member{}, err } var r...
go
func (mg *MailgunImpl) GetMember(ctx context.Context, s, l string) (Member, error) { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) response, err := makeGetRequest(ctx, r) if err != nil { return Member{}, err } var r...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetMember", "(", "ctx", "context", ".", "Context", ",", "s", ",", "l", "string", ")", "(", "Member", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateMemberApiUrl", "(", "mg", ",", "listsEn...
// GetMember returns a complete Member structure for a member of a mailing list, // given only their subscription e-mail address.
[ "GetMember", "returns", "a", "complete", "Member", "structure", "for", "a", "member", "of", "a", "mailing", "list", "given", "only", "their", "subscription", "e", "-", "mail", "address", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L160-L171
train
mailgun/mailgun-go
members.go
CreateMember
func (mg *MailgunImpl) CreateMember(ctx context.Context, merge bool, addr string, prototype Member) error { vs, err := json.Marshal(prototype.Vars) if err != nil { return err } r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey())...
go
func (mg *MailgunImpl) CreateMember(ctx context.Context, merge bool, addr string, prototype Member) error { vs, err := json.Marshal(prototype.Vars) if err != nil { return err } r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey())...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "CreateMember", "(", "ctx", "context", ".", "Context", ",", "merge", "bool", ",", "addr", "string", ",", "prototype", "Member", ")", "error", "{", "vs", ",", "err", ":=", "json", ".", "Marshal", "(", "prototy...
// CreateMember registers a new member of the indicated mailing list. // If merge is set to true, then the registration may update an existing Member's settings. // Otherwise, an error will occur if you attempt to add a member with a duplicate e-mail address.
[ "CreateMember", "registers", "a", "new", "member", "of", "the", "indicated", "mailing", "list", ".", "If", "merge", "is", "set", "to", "true", "then", "the", "registration", "may", "update", "an", "existing", "Member", "s", "settings", ".", "Otherwise", "an"...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L176-L195
train
mailgun/mailgun-go
members.go
UpdateMember
func (mg *MailgunImpl) UpdateMember(ctx context.Context, s, l string, prototype Member) (Member, error) { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newFormDataPayload() if prototype.Address != "" { p.addValue...
go
func (mg *MailgunImpl) UpdateMember(ctx context.Context, s, l string, prototype Member) (Member, error) { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) p := newFormDataPayload() if prototype.Address != "" { p.addValue...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "UpdateMember", "(", "ctx", "context", ".", "Context", ",", "s", ",", "l", "string", ",", "prototype", "Member", ")", "(", "Member", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateMemberApiU...
// UpdateMember lets you change certain details about the indicated mailing list member. // Address, Name, Vars, and Subscribed fields may be changed.
[ "UpdateMember", "lets", "you", "change", "certain", "details", "about", "the", "indicated", "mailing", "list", "member", ".", "Address", "Name", "Vars", "and", "Subscribed", "fields", "may", "be", "changed", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L199-L229
train
mailgun/mailgun-go
members.go
DeleteMember
func (mg *MailgunImpl) DeleteMember(ctx context.Context, member, addr string) error { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr) + "/" + member) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
go
func (mg *MailgunImpl) DeleteMember(ctx context.Context, member, addr string) error { r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr) + "/" + member) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) _, err := makeDeleteRequest(ctx, r) return err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "DeleteMember", "(", "ctx", "context", ".", "Context", ",", "member", ",", "addr", "string", ")", "error", "{", "r", ":=", "newHTTPRequest", "(", "generateMemberApiUrl", "(", "mg", ",", "listsEndpoint", ",", "add...
// DeleteMember removes the member from the list.
[ "DeleteMember", "removes", "the", "member", "from", "the", "list", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L232-L238
train
mailgun/mailgun-go
mock.go
NewMockServer
func NewMockServer() MockServer { ms := MockServer{} // Add all our handlers r := chi.NewRouter() r.Route("/v3", func(r chi.Router) { ms.addIPRoutes(r) ms.addExportRoutes(r) ms.addDomainRoutes(r) ms.addMailingListRoutes(r) ms.addEventRoutes(r) ms.addMessagesRoutes(r) ms.addValidationRoutes(r) ms.a...
go
func NewMockServer() MockServer { ms := MockServer{} // Add all our handlers r := chi.NewRouter() r.Route("/v3", func(r chi.Router) { ms.addIPRoutes(r) ms.addExportRoutes(r) ms.addDomainRoutes(r) ms.addMailingListRoutes(r) ms.addEventRoutes(r) ms.addMessagesRoutes(r) ms.addValidationRoutes(r) ms.a...
[ "func", "NewMockServer", "(", ")", "MockServer", "{", "ms", ":=", "MockServer", "{", "}", "\n\n", "// Add all our handlers", "r", ":=", "chi", ".", "NewRouter", "(", ")", "\n\n", "r", ".", "Route", "(", "\"", "\"", ",", "func", "(", "r", "chi", ".", ...
// Create a new instance of the mailgun API mock server
[ "Create", "a", "new", "instance", "of", "the", "mailgun", "API", "mock", "server" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mock.go#L30-L50
train
mailgun/mailgun-go
mock.go
pageOffsets
func pageOffsets(pivotIdx []string, pivotDir, pivotVal string, limit int) (int, int) { switch pivotDir { case "first": if limit < len(pivotIdx) { return 0, limit } return 0, len(pivotIdx) case "last": if limit < len(pivotIdx) { return len(pivotIdx) - limit, len(pivotIdx) } return 0, len(pivotIdx) ...
go
func pageOffsets(pivotIdx []string, pivotDir, pivotVal string, limit int) (int, int) { switch pivotDir { case "first": if limit < len(pivotIdx) { return 0, limit } return 0, len(pivotIdx) case "last": if limit < len(pivotIdx) { return len(pivotIdx) - limit, len(pivotIdx) } return 0, len(pivotIdx) ...
[ "func", "pageOffsets", "(", "pivotIdx", "[", "]", "string", ",", "pivotDir", ",", "pivotVal", "string", ",", "limit", "int", ")", "(", "int", ",", "int", ")", "{", "switch", "pivotDir", "{", "case", "\"", "\"", ":", "if", "limit", "<", "len", "(", ...
// Given the page direction, pivot value and limit, calculate the offsets for the slice
[ "Given", "the", "page", "direction", "pivot", "value", "and", "limit", "calculate", "the", "offsets", "for", "the", "slice" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mock.go#L123-L167
train
mailgun/mailgun-go
spam_complaints.go
ListComplaints
func (mg *MailgunImpl) ListComplaints(opts *ListOptions) *ComplaintsIterator { r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) if opts != nil { if opts.Limit != 0 { r.addParameter("limit", strconv.Itoa(opts.Limit)) } } url, err...
go
func (mg *MailgunImpl) ListComplaints(opts *ListOptions) *ComplaintsIterator { r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint)) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) if opts != nil { if opts.Limit != 0 { r.addParameter("limit", strconv.Itoa(opts.Limit)) } } url, err...
[ "func", "(", "mg", "*", "MailgunImpl", ")", "ListComplaints", "(", "opts", "*", "ListOptions", ")", "*", "ComplaintsIterator", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg", ",", "complaintsEndpoint", ")", ")", "\n", "r", ".", "setClient...
// ListComplaints returns a set of spam complaints registered against your domain. // Recipients of your messages can click on a link which sends feedback to Mailgun // indicating that the message they received is, to them, spam.
[ "ListComplaints", "returns", "a", "set", "of", "spam", "complaints", "registered", "against", "your", "domain", ".", "Recipients", "of", "your", "messages", "can", "click", "on", "a", "link", "which", "sends", "feedback", "to", "Mailgun", "indicating", "that", ...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/spam_complaints.go#L28-L43
train
mailgun/mailgun-go
spam_complaints.go
GetComplaint
func (mg *MailgunImpl) GetComplaint(ctx context.Context, address string) (Complaint, error) { r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint) + "/" + address) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var c Complaint err := getResponseFromJSON(ctx, r, &c) return c, err }
go
func (mg *MailgunImpl) GetComplaint(ctx context.Context, address string) (Complaint, error) { r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint) + "/" + address) r.setClient(mg.Client()) r.setBasicAuth(basicAuthUser, mg.APIKey()) var c Complaint err := getResponseFromJSON(ctx, r, &c) return c, err }
[ "func", "(", "mg", "*", "MailgunImpl", ")", "GetComplaint", "(", "ctx", "context", ".", "Context", ",", "address", "string", ")", "(", "Complaint", ",", "error", ")", "{", "r", ":=", "newHTTPRequest", "(", "generateApiUrl", "(", "mg", ",", "complaintsEndpo...
// GetComplaint returns a single complaint record filed by a recipient at the email address provided. // If no complaint exists, the Complaint instance returned will be empty.
[ "GetComplaint", "returns", "a", "single", "complaint", "record", "filed", "by", "a", "recipient", "at", "the", "email", "address", "provided", ".", "If", "no", "complaint", "exists", "the", "Complaint", "instance", "returned", "will", "be", "empty", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/spam_complaints.go#L144-L152
train
mailgun/mailgun-go
mailgun.go
NewMailgun
func NewMailgun(domain, apiKey string) *MailgunImpl { return &MailgunImpl{ apiBase: APIBase, domain: domain, apiKey: apiKey, client: http.DefaultClient, } }
go
func NewMailgun(domain, apiKey string) *MailgunImpl { return &MailgunImpl{ apiBase: APIBase, domain: domain, apiKey: apiKey, client: http.DefaultClient, } }
[ "func", "NewMailgun", "(", "domain", ",", "apiKey", "string", ")", "*", "MailgunImpl", "{", "return", "&", "MailgunImpl", "{", "apiBase", ":", "APIBase", ",", "domain", ":", "domain", ",", "apiKey", ":", "apiKey", ",", "client", ":", "http", ".", "Defaul...
// NewMailGun creates a new client instance.
[ "NewMailGun", "creates", "a", "new", "client", "instance", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L242-L249
train
mailgun/mailgun-go
mailgun.go
NewMailgunFromEnv
func NewMailgunFromEnv() (*MailgunImpl, error) { apiKey := os.Getenv("MG_API_KEY") if apiKey == "" { return nil, errors.New("required environment variable MG_API_KEY not defined") } domain := os.Getenv("MG_DOMAIN") if domain == "" { return nil, errors.New("required environment variable MG_DOMAIN not defined") ...
go
func NewMailgunFromEnv() (*MailgunImpl, error) { apiKey := os.Getenv("MG_API_KEY") if apiKey == "" { return nil, errors.New("required environment variable MG_API_KEY not defined") } domain := os.Getenv("MG_DOMAIN") if domain == "" { return nil, errors.New("required environment variable MG_DOMAIN not defined") ...
[ "func", "NewMailgunFromEnv", "(", ")", "(", "*", "MailgunImpl", ",", "error", ")", "{", "apiKey", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "apiKey", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", ...
// NewMailgunFromEnv returns a new Mailgun client using the environment variables // MG_API_KEY, MG_DOMAIN, and MG_URL
[ "NewMailgunFromEnv", "returns", "a", "new", "Mailgun", "client", "using", "the", "environment", "variables", "MG_API_KEY", "MG_DOMAIN", "and", "MG_URL" ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L253-L271
train
mailgun/mailgun-go
mailgun.go
generateApiUrlWithDomain
func generateApiUrlWithDomain(m Mailgun, endpoint, domain string) string { return fmt.Sprintf("%s/%s/%s", m.APIBase(), domain, endpoint) }
go
func generateApiUrlWithDomain(m Mailgun, endpoint, domain string) string { return fmt.Sprintf("%s/%s/%s", m.APIBase(), domain, endpoint) }
[ "func", "generateApiUrlWithDomain", "(", "m", "Mailgun", ",", "endpoint", ",", "domain", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "APIBase", "(", ")", ",", "domain", ",", "endpoint", ")", "\n", "}" ...
// generateApiUrlWithDomain renders a URL for an API endpoint using a separate domain and endpoint name.
[ "generateApiUrlWithDomain", "renders", "a", "URL", "for", "an", "API", "endpoint", "using", "a", "separate", "domain", "and", "endpoint", "name", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L309-L311
train
mailgun/mailgun-go
mailgun.go
generateMemberApiUrl
func generateMemberApiUrl(m Mailgun, endpoint, address string) string { return fmt.Sprintf("%s/%s/%s/members", m.APIBase(), endpoint, address) }
go
func generateMemberApiUrl(m Mailgun, endpoint, address string) string { return fmt.Sprintf("%s/%s/%s/members", m.APIBase(), endpoint, address) }
[ "func", "generateMemberApiUrl", "(", "m", "Mailgun", ",", "endpoint", ",", "address", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "APIBase", "(", ")", ",", "endpoint", ",", "address", ")", "\n", "}" ]
// generateMemberApiUrl renders a URL relevant for specifying mailing list members. // The address parameter refers to the mailing list in question.
[ "generateMemberApiUrl", "renders", "a", "URL", "relevant", "for", "specifying", "mailing", "list", "members", ".", "The", "address", "parameter", "refers", "to", "the", "mailing", "list", "in", "question", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L315-L317
train
mailgun/mailgun-go
mailgun.go
generateApiUrlWithTarget
func generateApiUrlWithTarget(m Mailgun, endpoint, target string) string { tail := "" if target != "" { tail = fmt.Sprintf("/%s", target) } return fmt.Sprintf("%s%s", generateApiUrl(m, endpoint), tail) }
go
func generateApiUrlWithTarget(m Mailgun, endpoint, target string) string { tail := "" if target != "" { tail = fmt.Sprintf("/%s", target) } return fmt.Sprintf("%s%s", generateApiUrl(m, endpoint), tail) }
[ "func", "generateApiUrlWithTarget", "(", "m", "Mailgun", ",", "endpoint", ",", "target", "string", ")", "string", "{", "tail", ":=", "\"", "\"", "\n", "if", "target", "!=", "\"", "\"", "{", "tail", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t...
// generateApiUrlWithTarget works as generateApiUrl, // but consumes an additional resource parameter called 'target'.
[ "generateApiUrlWithTarget", "works", "as", "generateApiUrl", "but", "consumes", "an", "additional", "resource", "parameter", "called", "target", "." ]
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L321-L327
train
mailgun/mailgun-go
mailgun.go
generateDomainApiUrl
func generateDomainApiUrl(m Mailgun, endpoint string) string { return fmt.Sprintf("%s/domains/%s/%s", m.APIBase(), m.Domain(), endpoint) }
go
func generateDomainApiUrl(m Mailgun, endpoint string) string { return fmt.Sprintf("%s/domains/%s/%s", m.APIBase(), m.Domain(), endpoint) }
[ "func", "generateDomainApiUrl", "(", "m", "Mailgun", ",", "endpoint", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "APIBase", "(", ")", ",", "m", ".", "Domain", "(", ")", ",", "endpoint", ")", "\n", ...
// generateDomainApiUrl renders a URL as generateApiUrl, but // addresses a family of functions which have a non-standard URL structure. // Most URLs consume a domain in the 2nd position, but some endpoints // require the word "domains" to be there instead.
[ "generateDomainApiUrl", "renders", "a", "URL", "as", "generateApiUrl", "but", "addresses", "a", "family", "of", "functions", "which", "have", "a", "non", "-", "standard", "URL", "structure", ".", "Most", "URLs", "consume", "a", "domain", "in", "the", "2nd", ...
df421608b66e7dd4c03112d5bb01525c51f344a2
https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L333-L335
train