in unstructured/google/networkservices/beta/http_route.go [351:1020]
func UnstructuredToHttpRoute(u *unstructured.Resource) (*dclService.HttpRoute, error) {
r := &dclService.HttpRoute{}
if _, ok := u.Object["createTime"]; ok {
if s, ok := u.Object["createTime"].(string); ok {
r.CreateTime = dcl.String(s)
} else {
return nil, fmt.Errorf("r.CreateTime: expected string")
}
}
if _, ok := u.Object["description"]; ok {
if s, ok := u.Object["description"].(string); ok {
r.Description = dcl.String(s)
} else {
return nil, fmt.Errorf("r.Description: expected string")
}
}
if _, ok := u.Object["gateways"]; ok {
if s, ok := u.Object["gateways"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
r.Gateways = append(r.Gateways, strval)
}
}
} else {
return nil, fmt.Errorf("r.Gateways: expected []interface{}")
}
}
if _, ok := u.Object["hostnames"]; ok {
if s, ok := u.Object["hostnames"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
r.Hostnames = append(r.Hostnames, strval)
}
}
} else {
return nil, fmt.Errorf("r.Hostnames: expected []interface{}")
}
}
if _, ok := u.Object["labels"]; ok {
if rLabels, ok := u.Object["labels"].(map[string]interface{}); ok {
m := make(map[string]string)
for k, v := range rLabels {
if s, ok := v.(string); ok {
m[k] = s
}
}
r.Labels = m
} else {
return nil, fmt.Errorf("r.Labels: expected map[string]interface{}")
}
}
if _, ok := u.Object["location"]; ok {
if s, ok := u.Object["location"].(string); ok {
r.Location = dcl.String(s)
} else {
return nil, fmt.Errorf("r.Location: expected string")
}
}
if _, ok := u.Object["meshes"]; ok {
if s, ok := u.Object["meshes"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
r.Meshes = append(r.Meshes, strval)
}
}
} else {
return nil, fmt.Errorf("r.Meshes: expected []interface{}")
}
}
if _, ok := u.Object["name"]; ok {
if s, ok := u.Object["name"].(string); ok {
r.Name = dcl.String(s)
} else {
return nil, fmt.Errorf("r.Name: expected string")
}
}
if _, ok := u.Object["project"]; ok {
if s, ok := u.Object["project"].(string); ok {
r.Project = dcl.String(s)
} else {
return nil, fmt.Errorf("r.Project: expected string")
}
}
if _, ok := u.Object["rules"]; ok {
if s, ok := u.Object["rules"].([]interface{}); ok {
for _, o := range s {
if objval, ok := o.(map[string]interface{}); ok {
var rRules dclService.HttpRouteRules
if _, ok := objval["action"]; ok {
if rRulesAction, ok := objval["action"].(map[string]interface{}); ok {
rRules.Action = &dclService.HttpRouteRulesAction{}
if _, ok := rRulesAction["corsPolicy"]; ok {
if rRulesActionCorsPolicy, ok := rRulesAction["corsPolicy"].(map[string]interface{}); ok {
rRules.Action.CorsPolicy = &dclService.HttpRouteRulesActionCorsPolicy{}
if _, ok := rRulesActionCorsPolicy["allowCredentials"]; ok {
if b, ok := rRulesActionCorsPolicy["allowCredentials"].(bool); ok {
rRules.Action.CorsPolicy.AllowCredentials = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.AllowCredentials: expected bool")
}
}
if _, ok := rRulesActionCorsPolicy["allowHeaders"]; ok {
if s, ok := rRulesActionCorsPolicy["allowHeaders"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.CorsPolicy.AllowHeaders = append(rRules.Action.CorsPolicy.AllowHeaders, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.AllowHeaders: expected []interface{}")
}
}
if _, ok := rRulesActionCorsPolicy["allowMethods"]; ok {
if s, ok := rRulesActionCorsPolicy["allowMethods"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.CorsPolicy.AllowMethods = append(rRules.Action.CorsPolicy.AllowMethods, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.AllowMethods: expected []interface{}")
}
}
if _, ok := rRulesActionCorsPolicy["allowOriginRegexes"]; ok {
if s, ok := rRulesActionCorsPolicy["allowOriginRegexes"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.CorsPolicy.AllowOriginRegexes = append(rRules.Action.CorsPolicy.AllowOriginRegexes, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.AllowOriginRegexes: expected []interface{}")
}
}
if _, ok := rRulesActionCorsPolicy["allowOrigins"]; ok {
if s, ok := rRulesActionCorsPolicy["allowOrigins"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.CorsPolicy.AllowOrigins = append(rRules.Action.CorsPolicy.AllowOrigins, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.AllowOrigins: expected []interface{}")
}
}
if _, ok := rRulesActionCorsPolicy["disabled"]; ok {
if b, ok := rRulesActionCorsPolicy["disabled"].(bool); ok {
rRules.Action.CorsPolicy.Disabled = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.Disabled: expected bool")
}
}
if _, ok := rRulesActionCorsPolicy["exposeHeaders"]; ok {
if s, ok := rRulesActionCorsPolicy["exposeHeaders"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.CorsPolicy.ExposeHeaders = append(rRules.Action.CorsPolicy.ExposeHeaders, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.ExposeHeaders: expected []interface{}")
}
}
if _, ok := rRulesActionCorsPolicy["maxAge"]; ok {
if s, ok := rRulesActionCorsPolicy["maxAge"].(string); ok {
rRules.Action.CorsPolicy.MaxAge = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy.MaxAge: expected string")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.CorsPolicy: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["destinations"]; ok {
if s, ok := rRulesAction["destinations"].([]interface{}); ok {
for _, o := range s {
if objval, ok := o.(map[string]interface{}); ok {
var rRulesActionDestinations dclService.HttpRouteRulesActionDestinations
if _, ok := objval["serviceName"]; ok {
if s, ok := objval["serviceName"].(string); ok {
rRulesActionDestinations.ServiceName = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesActionDestinations.ServiceName: expected string")
}
}
if _, ok := objval["weight"]; ok {
if i, ok := objval["weight"].(int64); ok {
rRulesActionDestinations.Weight = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRulesActionDestinations.Weight: expected int64")
}
}
rRules.Action.Destinations = append(rRules.Action.Destinations, rRulesActionDestinations)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.Destinations: expected []interface{}")
}
}
if _, ok := rRulesAction["faultInjectionPolicy"]; ok {
if rRulesActionFaultInjectionPolicy, ok := rRulesAction["faultInjectionPolicy"].(map[string]interface{}); ok {
rRules.Action.FaultInjectionPolicy = &dclService.HttpRouteRulesActionFaultInjectionPolicy{}
if _, ok := rRulesActionFaultInjectionPolicy["abort"]; ok {
if rRulesActionFaultInjectionPolicyAbort, ok := rRulesActionFaultInjectionPolicy["abort"].(map[string]interface{}); ok {
rRules.Action.FaultInjectionPolicy.Abort = &dclService.HttpRouteRulesActionFaultInjectionPolicyAbort{}
if _, ok := rRulesActionFaultInjectionPolicyAbort["httpStatus"]; ok {
if i, ok := rRulesActionFaultInjectionPolicyAbort["httpStatus"].(int64); ok {
rRules.Action.FaultInjectionPolicy.Abort.HttpStatus = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Abort.HttpStatus: expected int64")
}
}
if _, ok := rRulesActionFaultInjectionPolicyAbort["percentage"]; ok {
if i, ok := rRulesActionFaultInjectionPolicyAbort["percentage"].(int64); ok {
rRules.Action.FaultInjectionPolicy.Abort.Percentage = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Abort.Percentage: expected int64")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Abort: expected map[string]interface{}")
}
}
if _, ok := rRulesActionFaultInjectionPolicy["delay"]; ok {
if rRulesActionFaultInjectionPolicyDelay, ok := rRulesActionFaultInjectionPolicy["delay"].(map[string]interface{}); ok {
rRules.Action.FaultInjectionPolicy.Delay = &dclService.HttpRouteRulesActionFaultInjectionPolicyDelay{}
if _, ok := rRulesActionFaultInjectionPolicyDelay["fixedDelay"]; ok {
if s, ok := rRulesActionFaultInjectionPolicyDelay["fixedDelay"].(string); ok {
rRules.Action.FaultInjectionPolicy.Delay.FixedDelay = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Delay.FixedDelay: expected string")
}
}
if _, ok := rRulesActionFaultInjectionPolicyDelay["percentage"]; ok {
if i, ok := rRulesActionFaultInjectionPolicyDelay["percentage"].(int64); ok {
rRules.Action.FaultInjectionPolicy.Delay.Percentage = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Delay.Percentage: expected int64")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy.Delay: expected map[string]interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.FaultInjectionPolicy: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["redirect"]; ok {
if rRulesActionRedirect, ok := rRulesAction["redirect"].(map[string]interface{}); ok {
rRules.Action.Redirect = &dclService.HttpRouteRulesActionRedirect{}
if _, ok := rRulesActionRedirect["hostRedirect"]; ok {
if s, ok := rRulesActionRedirect["hostRedirect"].(string); ok {
rRules.Action.Redirect.HostRedirect = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.HostRedirect: expected string")
}
}
if _, ok := rRulesActionRedirect["httpsRedirect"]; ok {
if b, ok := rRulesActionRedirect["httpsRedirect"].(bool); ok {
rRules.Action.Redirect.HttpsRedirect = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.HttpsRedirect: expected bool")
}
}
if _, ok := rRulesActionRedirect["pathRedirect"]; ok {
if s, ok := rRulesActionRedirect["pathRedirect"].(string); ok {
rRules.Action.Redirect.PathRedirect = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.PathRedirect: expected string")
}
}
if _, ok := rRulesActionRedirect["portRedirect"]; ok {
if i, ok := rRulesActionRedirect["portRedirect"].(int64); ok {
rRules.Action.Redirect.PortRedirect = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.PortRedirect: expected int64")
}
}
if _, ok := rRulesActionRedirect["prefixRewrite"]; ok {
if s, ok := rRulesActionRedirect["prefixRewrite"].(string); ok {
rRules.Action.Redirect.PrefixRewrite = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.PrefixRewrite: expected string")
}
}
if _, ok := rRulesActionRedirect["responseCode"]; ok {
if s, ok := rRulesActionRedirect["responseCode"].(string); ok {
rRules.Action.Redirect.ResponseCode = dclService.HttpRouteRulesActionRedirectResponseCodeEnumRef(s)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.ResponseCode: expected string")
}
}
if _, ok := rRulesActionRedirect["stripQuery"]; ok {
if b, ok := rRulesActionRedirect["stripQuery"].(bool); ok {
rRules.Action.Redirect.StripQuery = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRules.Action.Redirect.StripQuery: expected bool")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.Redirect: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["requestHeaderModifier"]; ok {
if rRulesActionRequestHeaderModifier, ok := rRulesAction["requestHeaderModifier"].(map[string]interface{}); ok {
rRules.Action.RequestHeaderModifier = &dclService.HttpRouteRulesActionRequestHeaderModifier{}
if _, ok := rRulesActionRequestHeaderModifier["add"]; ok {
if rRulesActionRequestHeaderModifierAdd, ok := rRulesActionRequestHeaderModifier["add"].(map[string]interface{}); ok {
m := make(map[string]string)
for k, v := range rRulesActionRequestHeaderModifierAdd {
if s, ok := v.(string); ok {
m[k] = s
}
}
rRules.Action.RequestHeaderModifier.Add = m
} else {
return nil, fmt.Errorf("rRules.Action.RequestHeaderModifier.Add: expected map[string]interface{}")
}
}
if _, ok := rRulesActionRequestHeaderModifier["remove"]; ok {
if s, ok := rRulesActionRequestHeaderModifier["remove"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.RequestHeaderModifier.Remove = append(rRules.Action.RequestHeaderModifier.Remove, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RequestHeaderModifier.Remove: expected []interface{}")
}
}
if _, ok := rRulesActionRequestHeaderModifier["set"]; ok {
if rRulesActionRequestHeaderModifierSet, ok := rRulesActionRequestHeaderModifier["set"].(map[string]interface{}); ok {
m := make(map[string]string)
for k, v := range rRulesActionRequestHeaderModifierSet {
if s, ok := v.(string); ok {
m[k] = s
}
}
rRules.Action.RequestHeaderModifier.Set = m
} else {
return nil, fmt.Errorf("rRules.Action.RequestHeaderModifier.Set: expected map[string]interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RequestHeaderModifier: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["requestMirrorPolicy"]; ok {
if rRulesActionRequestMirrorPolicy, ok := rRulesAction["requestMirrorPolicy"].(map[string]interface{}); ok {
rRules.Action.RequestMirrorPolicy = &dclService.HttpRouteRulesActionRequestMirrorPolicy{}
if _, ok := rRulesActionRequestMirrorPolicy["destination"]; ok {
if rRulesActionRequestMirrorPolicyDestination, ok := rRulesActionRequestMirrorPolicy["destination"].(map[string]interface{}); ok {
rRules.Action.RequestMirrorPolicy.Destination = &dclService.HttpRouteRulesActionRequestMirrorPolicyDestination{}
if _, ok := rRulesActionRequestMirrorPolicyDestination["serviceName"]; ok {
if s, ok := rRulesActionRequestMirrorPolicyDestination["serviceName"].(string); ok {
rRules.Action.RequestMirrorPolicy.Destination.ServiceName = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.RequestMirrorPolicy.Destination.ServiceName: expected string")
}
}
if _, ok := rRulesActionRequestMirrorPolicyDestination["weight"]; ok {
if i, ok := rRulesActionRequestMirrorPolicyDestination["weight"].(int64); ok {
rRules.Action.RequestMirrorPolicy.Destination.Weight = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.RequestMirrorPolicy.Destination.Weight: expected int64")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RequestMirrorPolicy.Destination: expected map[string]interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RequestMirrorPolicy: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["responseHeaderModifier"]; ok {
if rRulesActionResponseHeaderModifier, ok := rRulesAction["responseHeaderModifier"].(map[string]interface{}); ok {
rRules.Action.ResponseHeaderModifier = &dclService.HttpRouteRulesActionResponseHeaderModifier{}
if _, ok := rRulesActionResponseHeaderModifier["add"]; ok {
if rRulesActionResponseHeaderModifierAdd, ok := rRulesActionResponseHeaderModifier["add"].(map[string]interface{}); ok {
m := make(map[string]string)
for k, v := range rRulesActionResponseHeaderModifierAdd {
if s, ok := v.(string); ok {
m[k] = s
}
}
rRules.Action.ResponseHeaderModifier.Add = m
} else {
return nil, fmt.Errorf("rRules.Action.ResponseHeaderModifier.Add: expected map[string]interface{}")
}
}
if _, ok := rRulesActionResponseHeaderModifier["remove"]; ok {
if s, ok := rRulesActionResponseHeaderModifier["remove"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.ResponseHeaderModifier.Remove = append(rRules.Action.ResponseHeaderModifier.Remove, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.ResponseHeaderModifier.Remove: expected []interface{}")
}
}
if _, ok := rRulesActionResponseHeaderModifier["set"]; ok {
if rRulesActionResponseHeaderModifierSet, ok := rRulesActionResponseHeaderModifier["set"].(map[string]interface{}); ok {
m := make(map[string]string)
for k, v := range rRulesActionResponseHeaderModifierSet {
if s, ok := v.(string); ok {
m[k] = s
}
}
rRules.Action.ResponseHeaderModifier.Set = m
} else {
return nil, fmt.Errorf("rRules.Action.ResponseHeaderModifier.Set: expected map[string]interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.ResponseHeaderModifier: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["retryPolicy"]; ok {
if rRulesActionRetryPolicy, ok := rRulesAction["retryPolicy"].(map[string]interface{}); ok {
rRules.Action.RetryPolicy = &dclService.HttpRouteRulesActionRetryPolicy{}
if _, ok := rRulesActionRetryPolicy["numRetries"]; ok {
if i, ok := rRulesActionRetryPolicy["numRetries"].(int64); ok {
rRules.Action.RetryPolicy.NumRetries = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRules.Action.RetryPolicy.NumRetries: expected int64")
}
}
if _, ok := rRulesActionRetryPolicy["perTryTimeout"]; ok {
if s, ok := rRulesActionRetryPolicy["perTryTimeout"].(string); ok {
rRules.Action.RetryPolicy.PerTryTimeout = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.RetryPolicy.PerTryTimeout: expected string")
}
}
if _, ok := rRulesActionRetryPolicy["retryConditions"]; ok {
if s, ok := rRulesActionRetryPolicy["retryConditions"].([]interface{}); ok {
for _, ss := range s {
if strval, ok := ss.(string); ok {
rRules.Action.RetryPolicy.RetryConditions = append(rRules.Action.RetryPolicy.RetryConditions, strval)
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RetryPolicy.RetryConditions: expected []interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.RetryPolicy: expected map[string]interface{}")
}
}
if _, ok := rRulesAction["timeout"]; ok {
if s, ok := rRulesAction["timeout"].(string); ok {
rRules.Action.Timeout = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.Timeout: expected string")
}
}
if _, ok := rRulesAction["urlRewrite"]; ok {
if rRulesActionUrlRewrite, ok := rRulesAction["urlRewrite"].(map[string]interface{}); ok {
rRules.Action.UrlRewrite = &dclService.HttpRouteRulesActionUrlRewrite{}
if _, ok := rRulesActionUrlRewrite["hostRewrite"]; ok {
if s, ok := rRulesActionUrlRewrite["hostRewrite"].(string); ok {
rRules.Action.UrlRewrite.HostRewrite = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.UrlRewrite.HostRewrite: expected string")
}
}
if _, ok := rRulesActionUrlRewrite["pathPrefixRewrite"]; ok {
if s, ok := rRulesActionUrlRewrite["pathPrefixRewrite"].(string); ok {
rRules.Action.UrlRewrite.PathPrefixRewrite = dcl.String(s)
} else {
return nil, fmt.Errorf("rRules.Action.UrlRewrite.PathPrefixRewrite: expected string")
}
}
} else {
return nil, fmt.Errorf("rRules.Action.UrlRewrite: expected map[string]interface{}")
}
}
} else {
return nil, fmt.Errorf("rRules.Action: expected map[string]interface{}")
}
}
if _, ok := objval["matches"]; ok {
if s, ok := objval["matches"].([]interface{}); ok {
for _, o := range s {
if objval, ok := o.(map[string]interface{}); ok {
var rRulesMatches dclService.HttpRouteRulesMatches
if _, ok := objval["fullPathMatch"]; ok {
if s, ok := objval["fullPathMatch"].(string); ok {
rRulesMatches.FullPathMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatches.FullPathMatch: expected string")
}
}
if _, ok := objval["headers"]; ok {
if s, ok := objval["headers"].([]interface{}); ok {
for _, o := range s {
if objval, ok := o.(map[string]interface{}); ok {
var rRulesMatchesHeaders dclService.HttpRouteRulesMatchesHeaders
if _, ok := objval["exactMatch"]; ok {
if s, ok := objval["exactMatch"].(string); ok {
rRulesMatchesHeaders.ExactMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.ExactMatch: expected string")
}
}
if _, ok := objval["header"]; ok {
if s, ok := objval["header"].(string); ok {
rRulesMatchesHeaders.Header = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.Header: expected string")
}
}
if _, ok := objval["invertMatch"]; ok {
if b, ok := objval["invertMatch"].(bool); ok {
rRulesMatchesHeaders.InvertMatch = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.InvertMatch: expected bool")
}
}
if _, ok := objval["prefixMatch"]; ok {
if s, ok := objval["prefixMatch"].(string); ok {
rRulesMatchesHeaders.PrefixMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.PrefixMatch: expected string")
}
}
if _, ok := objval["presentMatch"]; ok {
if b, ok := objval["presentMatch"].(bool); ok {
rRulesMatchesHeaders.PresentMatch = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.PresentMatch: expected bool")
}
}
if _, ok := objval["rangeMatch"]; ok {
if rRulesMatchesHeadersRangeMatch, ok := objval["rangeMatch"].(map[string]interface{}); ok {
rRulesMatchesHeaders.RangeMatch = &dclService.HttpRouteRulesMatchesHeadersRangeMatch{}
if _, ok := rRulesMatchesHeadersRangeMatch["end"]; ok {
if i, ok := rRulesMatchesHeadersRangeMatch["end"].(int64); ok {
rRulesMatchesHeaders.RangeMatch.End = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.RangeMatch.End: expected int64")
}
}
if _, ok := rRulesMatchesHeadersRangeMatch["start"]; ok {
if i, ok := rRulesMatchesHeadersRangeMatch["start"].(int64); ok {
rRulesMatchesHeaders.RangeMatch.Start = dcl.Int64(i)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.RangeMatch.Start: expected int64")
}
}
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.RangeMatch: expected map[string]interface{}")
}
}
if _, ok := objval["regexMatch"]; ok {
if s, ok := objval["regexMatch"].(string); ok {
rRulesMatchesHeaders.RegexMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.RegexMatch: expected string")
}
}
if _, ok := objval["suffixMatch"]; ok {
if s, ok := objval["suffixMatch"].(string); ok {
rRulesMatchesHeaders.SuffixMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesHeaders.SuffixMatch: expected string")
}
}
rRulesMatches.Headers = append(rRulesMatches.Headers, rRulesMatchesHeaders)
}
}
} else {
return nil, fmt.Errorf("rRulesMatches.Headers: expected []interface{}")
}
}
if _, ok := objval["ignoreCase"]; ok {
if b, ok := objval["ignoreCase"].(bool); ok {
rRulesMatches.IgnoreCase = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRulesMatches.IgnoreCase: expected bool")
}
}
if _, ok := objval["prefixMatch"]; ok {
if s, ok := objval["prefixMatch"].(string); ok {
rRulesMatches.PrefixMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatches.PrefixMatch: expected string")
}
}
if _, ok := objval["queryParameters"]; ok {
if s, ok := objval["queryParameters"].([]interface{}); ok {
for _, o := range s {
if objval, ok := o.(map[string]interface{}); ok {
var rRulesMatchesQueryParameters dclService.HttpRouteRulesMatchesQueryParameters
if _, ok := objval["exactMatch"]; ok {
if s, ok := objval["exactMatch"].(string); ok {
rRulesMatchesQueryParameters.ExactMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesQueryParameters.ExactMatch: expected string")
}
}
if _, ok := objval["presentMatch"]; ok {
if b, ok := objval["presentMatch"].(bool); ok {
rRulesMatchesQueryParameters.PresentMatch = dcl.Bool(b)
} else {
return nil, fmt.Errorf("rRulesMatchesQueryParameters.PresentMatch: expected bool")
}
}
if _, ok := objval["queryParameter"]; ok {
if s, ok := objval["queryParameter"].(string); ok {
rRulesMatchesQueryParameters.QueryParameter = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesQueryParameters.QueryParameter: expected string")
}
}
if _, ok := objval["regexMatch"]; ok {
if s, ok := objval["regexMatch"].(string); ok {
rRulesMatchesQueryParameters.RegexMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatchesQueryParameters.RegexMatch: expected string")
}
}
rRulesMatches.QueryParameters = append(rRulesMatches.QueryParameters, rRulesMatchesQueryParameters)
}
}
} else {
return nil, fmt.Errorf("rRulesMatches.QueryParameters: expected []interface{}")
}
}
if _, ok := objval["regexMatch"]; ok {
if s, ok := objval["regexMatch"].(string); ok {
rRulesMatches.RegexMatch = dcl.String(s)
} else {
return nil, fmt.Errorf("rRulesMatches.RegexMatch: expected string")
}
}
rRules.Matches = append(rRules.Matches, rRulesMatches)
}
}
} else {
return nil, fmt.Errorf("rRules.Matches: expected []interface{}")
}
}
r.Rules = append(r.Rules, rRules)
}
}
} else {
return nil, fmt.Errorf("r.Rules: expected []interface{}")
}
}
if _, ok := u.Object["selfLink"]; ok {
if s, ok := u.Object["selfLink"].(string); ok {
r.SelfLink = dcl.String(s)
} else {
return nil, fmt.Errorf("r.SelfLink: expected string")
}
}
if _, ok := u.Object["updateTime"]; ok {
if s, ok := u.Object["updateTime"].(string); ok {
r.UpdateTime = dcl.String(s)
} else {
return nil, fmt.Errorf("r.UpdateTime: expected string")
}
}
return r, nil
}