mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
7e04cee958
This was done as its own resource as suggested in slack, since we don't have the option of making all fields Computed in google_compute_instance. There's precedent in the aws provider for this sort of thing (see ami_copy, ami_from_instance). When I started working on this I assumed I could do it in the compute_instance resource and so I went ahead and reordered the schema to make it easier to work with in the future. Now it's not quite relevant, but I left it in as its own commit that can be looked at separately from the other changes. Fixes #1582.
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
// Copyright (c) 2017, A. Stoewer <adrian.stoewer@rz.ifi.lmu.de>
|
|
// All rights reserved.
|
|
|
|
package strcase
|
|
|
|
// isLower checks if a character is lower case. More precisely it evaluates if it is
|
|
// in the range of ASCII character 'a' to 'z'.
|
|
func isLower(ch rune) bool {
|
|
return ch >= 'a' && ch <= 'z'
|
|
}
|
|
|
|
// toLower converts a character in the range of ASCII characters 'A' to 'Z' to its lower
|
|
// case counterpart. Other characters remain the same.
|
|
func toLower(ch rune) rune {
|
|
if ch >= 'A' && ch <= 'Z' {
|
|
return ch + 32
|
|
}
|
|
return ch
|
|
}
|
|
|
|
// isLower checks if a character is upper case. More precisely it evaluates if it is
|
|
// in the range of ASCII characters 'A' to 'Z'.
|
|
func isUpper(ch rune) bool {
|
|
return ch >= 'A' && ch <= 'Z'
|
|
}
|
|
|
|
// toLower converts a character in the range of ASCII characters 'a' to 'z' to its lower
|
|
// case counterpart. Other characters remain the same.
|
|
func toUpper(ch rune) rune {
|
|
if ch >= 'a' && ch <= 'z' {
|
|
return ch - 32
|
|
}
|
|
return ch
|
|
}
|
|
|
|
// isSpace checks if a character is some kind of whitespace.
|
|
func isSpace(ch rune) bool {
|
|
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'
|
|
}
|
|
|
|
// isDelimiter checks if a character is some kind of whitespace or '_' or '-'.
|
|
func isDelimiter(ch rune) bool {
|
|
return ch == '-' || ch == '_' || isSpace(ch)
|
|
}
|