text stringlengths 2 1.04M | meta dict |
|---|---|
.av201807-point-style-modifier-dialog {
background-color: white;
}
.av201807-point-style-modifier-dialog > div.reset-button {
position: absolute;
top: 5px;
right: 0px;
width: 20px;
height: 20px;
}
.av201807-point-style-modifier-dialog > div.reset-button > div {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
border-bottom: 9px solid transparent;
border-left: 9px solid black;
transform: rotate(-45deg);
}
.av201807-point-style-modifier-dialog > div.reset-button > div:after {
content: "";
position: absolute;
border: 0 solid transparent;
border-top: 3px solid black;
border-radius: 20px 0 0 0;
top: 6px;
left: -10px;
width: 12px;
height: 12px;
transform: scaleY(-1) rotate(135deg);
}
.av201807-point-style-modifier-dialog table {
margin: 0.7em;
border-collapse: separate;
border-spacing: 0.5em 0;
}
.av201807-point-style-modifier-dialog tr.title td {
text-align: center;
font-size: 0.8em;
}
.av201807-point-style-modifier-dialog td[name="F"] {
width: 60px;
}
.av201807-point-style-modifier-dialog td[name="O"] {
width: 60px;
}
.av201807-point-style-modifier-dialog div.fill-color {
width: 13px;
height: 13px;
margin: 3px;
float: left;
}
.av201807-point-style-modifier-dialog div.fill-color.white {
width: 7px;
height: 7px;
border: 3px dashed #E0E0E0;
}
.av201807-point-style-modifier-dialog div.fill-color.transparent {
background-image: repeating-linear-gradient(to top left, white , #D0D0D0 4px);
}
.av201807-point-style-modifier-dialog div.outline-color {
width: 7px;
height: 7px;
margin: 3px;
float: left;
}
.av201807-point-style-modifier-dialog div.outline-color.transparent {
background-color: transparent;
border: 3px dashed #D0D0D0;
}
.av201807-point-style-modifier-dialog .av-point-style-slider-vertical {
display: inline-block;
width: 20px;
height: 150px;
padding: 0;
}
.av201807-point-style-modifier-dialog .av-point-style-slider-vertical input {
width: 150px;
height: 20px;
margin: 0;
transform-origin: 75px 75px;
transform: rotate(-90deg);
}
.av201807-point-style-modifier-dialog td.av-point-style-slider-value {
text-align: center;
}
.av201807-point-style-modifier-dialog span.av-point-style-slider-value {
font-size: 0.8em;
}
.av201807-point-style-modifier-dialog td.shape div {
float: left;
margin-top: 5px;
margin-bottom: 5px;
}
.av201807-point-style-modifier-dialog td.shape div.label {
font-size: 0.8em;
}
.av201807-point-style-modifier-dialog td.shape div.shape {
width: 16px;
height: 16px;
background: #808080;
margin-left: 12px;
}
.av201807-point-style-modifier-dialog td.shape div.shape[name="circle"] {
border-radius: 8px;
}
.av201807-point-style-modifier-dialog td.shape div.shape[name="triangle"] {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 16px solid #808080;
background: transparent;
}
/* ---------------------------------------------------------------------- */
/* Local Variables: */
/* eval: (if (fboundp 'eu-rename-buffer) (eu-rename-buffer)) */
/* End: */
| {
"content_hash": "d44d7220eec5a9a631de8425ad360d0b",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 82,
"avg_line_length": 23.21985815602837,
"alnum_prop": 0.6579108124618204,
"repo_name": "acorg/acmacs-map-draw",
"id": "2910d05b87c9588534e3b2581127f83fa111945d",
"size": "3274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "js/ace-view/201807/point-style.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "600295"
},
{
"name": "CSS",
"bytes": "42664"
},
{
"name": "HTML",
"bytes": "5475"
},
{
"name": "JavaScript",
"bytes": "357978"
},
{
"name": "Makefile",
"bytes": "4898"
},
{
"name": "Shell",
"bytes": "3693"
}
],
"symlink_target": ""
} |
/**
*
*/
package com.jarp.tutorials.bigranchprohects.ch19;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.UUID;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONTokener;
import android.content.Context;
import android.util.Log;
/**
* @author JARP
*
*/
public class CrimeLab {
private ArrayList<Crime> mCrimes;
private static final String TAG= "CrimeLab";
private static final String fileName = "crimes.json";
private CriminalIntentJsonSerializer mSerializer;
private static CrimeLab sCrimeLab;
private Context mAppContext;
private CrimeLab(Context context)
{
mAppContext= context;
mSerializer = new CriminalIntentJsonSerializer(mAppContext, fileName);
try
{
mCrimes = mSerializer.loadCrimes();
}
catch(Exception e)
{
mCrimes = new ArrayList<Crime>();
Log.e(TAG, "Error al cargar crimes " + e.getMessage());
}
}
public static CrimeLab get (Context c)
{
if(sCrimeLab ==null)
sCrimeLab = new CrimeLab(c.getApplicationContext());
return sCrimeLab;
}
public ArrayList<Crime> getCrimes()
{
return mCrimes;
}
public Crime getCrime( UUID id)
{
for (Crime c : mCrimes) {
if(c.getmId().equals(id))
return c;
}
return null;
}
public void addCrime(Crime c)
{
mCrimes.add(c);
}
public void deleteCrime(Crime c)
{
mCrimes.remove(c);
}
public boolean saveCrimes()
{
try {
mSerializer.saveCrimes(mCrimes);
Log.d(TAG, "crimes saved to file");
return true;
} catch (Exception e) {
Log.e(TAG, "Error saving crimes " , e);
return false;
}
}
}
| {
"content_hash": "e58073d67f7c30bd65807458f971959c",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 72,
"avg_line_length": 15.926605504587156,
"alnum_prop": 0.6849078341013825,
"repo_name": "imjarp/big-ranch-examples",
"id": "78bd114b00c45488d1a4f42fd4b999a1fa00a057",
"size": "1736",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/jarp/tutorials/bigranchprohects/ch19/CrimeLab.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "207777"
}
],
"symlink_target": ""
} |
import unittest
from autothreadharness.harness_case import HarnessCase
class SED_6_2_1(HarnessCase):
role = HarnessCase.ROLE_SED
case = '6 2 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "89b16775885879111ed5684e384a7c4f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 18.125,
"alnum_prop": 0.6482758620689655,
"repo_name": "turon/openthread",
"id": "8f340d829ad624e0ce565f65815472b997f1c56d",
"size": "1872",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/harness-automation/cases/sed_6_2_1.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "50"
},
{
"name": "C",
"bytes": "1034514"
},
{
"name": "C++",
"bytes": "4480499"
},
{
"name": "Dockerfile",
"bytes": "6306"
},
{
"name": "M4",
"bytes": "36666"
},
{
"name": "Makefile",
"bytes": "138336"
},
{
"name": "Python",
"bytes": "2160064"
},
{
"name": "Shell",
"bytes": "73650"
}
],
"symlink_target": ""
} |
package com.mcleodmoores.starling.client.marketdata;
import org.joda.convert.FromString;
import com.opengamma.util.AbstractNamedInstanceFactory;
import com.opengamma.util.ArgumentChecker;
/**
* Factory for creating and registering named instances of DataField.
* This pattern is used because it saves memory and more importantly, UI tools can query available values.
*/
public class DataFieldFactory extends AbstractNamedInstanceFactory<DataField> {
/**
* Singleton instance.
*/
public static final DataFieldFactory INSTANCE = new DataFieldFactory();
/**
* Protected no-arg constructor.
*/
protected DataFieldFactory() {
super(DataField.class);
}
/**
* Return the named instance of a DataField given a name, and create one if one isn't available.
* @param name the name of the DataField
* @return the instance of the data field corresponding to the name
*/
@FromString
public DataField of(final String name) {
try {
return instance(name);
} catch (final IllegalArgumentException e) {
ArgumentChecker.notNull(name, "name");
final DataField dataField = DataField.parse(name);
return addInstance(dataField);
}
}
}
| {
"content_hash": "9e6ad70c47e2f7c0b203880ba6ae0e72",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 106,
"avg_line_length": 29.341463414634145,
"alnum_prop": 0.7265170407315046,
"repo_name": "McLeodMoores/starling",
"id": "b8927ad87af73299d8c326b506d4c8baaecae5ff",
"size": "1296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "projects/starling-client/src/main/java/com/mcleodmoores/starling/client/marketdata/DataFieldFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2505"
},
{
"name": "CSS",
"bytes": "213501"
},
{
"name": "FreeMarker",
"bytes": "310184"
},
{
"name": "GAP",
"bytes": "1490"
},
{
"name": "Groovy",
"bytes": "11518"
},
{
"name": "HTML",
"bytes": "318295"
},
{
"name": "Java",
"bytes": "79541905"
},
{
"name": "JavaScript",
"bytes": "1511230"
},
{
"name": "PLSQL",
"bytes": "398"
},
{
"name": "PLpgSQL",
"bytes": "26901"
},
{
"name": "Shell",
"bytes": "11481"
},
{
"name": "TSQL",
"bytes": "604117"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_29) on Wed Jan 01 17:06:44 EST 2014 -->
<TITLE>
Character (2013 FRC Java API)
</TITLE>
<META NAME="date" CONTENT="2014-01-01">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Character (2013 FRC Java API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Character.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
"<p style=\"background-color:${javadoc.bgcolor}; color:${javadoc.fgcolor}; padding:4px 5px 2px 3px; margin-top:-1px\"><b>2013 FRC Java API</b></p>"</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Byte.html" title="class in java.lang"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Class.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?java/lang/Character.html" target="_top"><B>FRAMES</B></A>
<A HREF="Character.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
java.lang</FONT>
<BR>
Class Character</H2>
<PRE>
<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.lang.Character</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>Character</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></DL>
</PRE>
<P>
The Character class wraps a value of the primitive type <code>char</code>
in an object. An object of type <code>Character</code> contains a
single field whose type is <code>char</code>.
<p>
In addition, this class provides several methods for determining
the type of a character and converting characters from uppercase
to lowercase and vice versa.
<p>
Character information is based on the Unicode Standard, version 3.0.
However, in order to reduce footprint, by default the character
property and case conversion operations in CLDC are available
only for the ISO Latin-1 range of characters. Other Unicode
character blocks can be supported as necessary.
<p>
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>JDK1.0, CLDC 1.0</DD>
<DT><B>Version:</B></DT>
<DD>12/17/01 (CLDC 1.1)</DD>
</DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#MAX_RADIX">MAX_RADIX</A></B></CODE>
<BR>
The maximum radix available for conversion to and from Strings.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#MAX_VALUE">MAX_VALUE</A></B></CODE>
<BR>
The constant value of this field is the largest value of type
<code>char</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#MIN_RADIX">MIN_RADIX</A></B></CODE>
<BR>
The minimum radix available for conversion to and from Strings.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#MIN_VALUE">MIN_VALUE</A></B></CODE>
<BR>
The constant value of this field is the smallest value of type
<code>char</code>.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../java/lang/Character.html#Character(char)">Character</A></B>(char value)</CODE>
<BR>
Constructs a <code>Character</code> object and initializes it so
that it represents the primitive <code>value</code> argument.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#charValue()">charValue</A></B>()</CODE>
<BR>
Returns the value of this Character object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#digit(char, int)">digit</A></B>(char ch,
int radix)</CODE>
<BR>
Returns the numeric value of the character <code>ch</code> in the
specified radix.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> obj)</CODE>
<BR>
Compares this object against the specified object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#hashCode()">hashCode</A></B>()</CODE>
<BR>
Returns a hash code for this Character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#isDigit(char)">isDigit</A></B>(char ch)</CODE>
<BR>
Determines if the specified character is a digit.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#isLowerCase(char)">isLowerCase</A></B>(char ch)</CODE>
<BR>
Determines if the specified character is a lowercase character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#isUpperCase(char)">isUpperCase</A></B>(char ch)</CODE>
<BR>
Determines if the specified character is an uppercase character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#toLowerCase(char)">toLowerCase</A></B>(char ch)</CODE>
<BR>
The given character is mapped to its lowercase equivalent; if the
character has no lowercase equivalent, the character itself is
returned.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#toString()">toString</A></B>()</CODE>
<BR>
Returns a String object representing this character's value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#toUpperCase(char)">toUpperCase</A></B>(char ch)</CODE>
<BR>
Converts the character argument to uppercase; if the
character has no uppercase equivalent, the character itself is
returned.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../java/lang/Character.html" title="class in java.lang">Character</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Character.html#valueOf(char)">valueOf</A></B>(char val)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="MIN_RADIX"><!-- --></A><H3>
MIN_RADIX</H3>
<PRE>
public static final int <B>MIN_RADIX</B></PRE>
<DL>
<DD>The minimum radix available for conversion to and from Strings.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>Integer.toString(int, int)</CODE></A>,
<A HREF="../../java/lang/Integer.html#valueOf(java.lang.String)"><CODE>Integer.valueOf(java.lang.String)</CODE></A>,
<A HREF="../../constant-values.html#java.lang.Character.MIN_RADIX">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="MAX_RADIX"><!-- --></A><H3>
MAX_RADIX</H3>
<PRE>
public static final int <B>MAX_RADIX</B></PRE>
<DL>
<DD>The maximum radix available for conversion to and from Strings.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>Integer.toString(int, int)</CODE></A>,
<A HREF="../../java/lang/Integer.html#valueOf(java.lang.String)"><CODE>Integer.valueOf(java.lang.String)</CODE></A>,
<A HREF="../../constant-values.html#java.lang.Character.MAX_RADIX">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="MIN_VALUE"><!-- --></A><H3>
MIN_VALUE</H3>
<PRE>
public static final char <B>MIN_VALUE</B></PRE>
<DL>
<DD>The constant value of this field is the smallest value of type
<code>char</code>.
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>JDK1.0.2</DD>
<DT><B>See Also:</B><DD><A HREF="../../constant-values.html#java.lang.Character.MIN_VALUE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="MAX_VALUE"><!-- --></A><H3>
MAX_VALUE</H3>
<PRE>
public static final char <B>MAX_VALUE</B></PRE>
<DL>
<DD>The constant value of this field is the largest value of type
<code>char</code>.
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>JDK1.0.2</DD>
<DT><B>See Also:</B><DD><A HREF="../../constant-values.html#java.lang.Character.MAX_VALUE">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Character(char)"><!-- --></A><H3>
Character</H3>
<PRE>
public <B>Character</B>(char value)</PRE>
<DL>
<DD>Constructs a <code>Character</code> object and initializes it so
that it represents the primitive <code>value</code> argument.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - value for the new <code>Character</code> object.</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="charValue()"><!-- --></A><H3>
charValue</H3>
<PRE>
public char <B>charValue</B>()</PRE>
<DL>
<DD>Returns the value of this Character object.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the primitive <code>char</code> value represented by
this object.</DL>
</DD>
</DL>
<HR>
<A NAME="hashCode()"><!-- --></A><H3>
hashCode</H3>
<PRE>
public int <B>hashCode</B>()</PRE>
<DL>
<DD>Returns a hash code for this Character.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a hash code value for this object.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(java.lang.Object)</CODE></A>,
<A HREF="../../java/util/Hashtable.html" title="class in java.util"><CODE>Hashtable</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> obj)</PRE>
<DL>
<DD>Compares this object against the specified object.
The result is <code>true</code> if and only if the argument is not
<code>null</code> and is a <code>Character</code> object that
represents the same <code>char</code> value as this object.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to compare with.
<DT><B>Returns:</B><DD><code>true</code> if the objects are the same;
<code>false</code> otherwise.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Boolean.html#hashCode()"><CODE>Boolean.hashCode()</CODE></A>,
<A HREF="../../java/util/Hashtable.html" title="class in java.util"><CODE>Hashtable</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toString</B>()</PRE>
<DL>
<DD>Returns a String object representing this character's value.
Converts this <code>Character</code> object to a string. The
result is a string whose length is <code>1</code>. The string's
sole component is the primitive <code>char</code> value represented
by this object.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a string representation of this object.</DL>
</DD>
</DL>
<HR>
<A NAME="isLowerCase(char)"><!-- --></A><H3>
isLowerCase</H3>
<PRE>
public static boolean <B>isLowerCase</B>(char ch)</PRE>
<DL>
<DD>Determines if the specified character is a lowercase character.
<p>
Note that by default CLDC only supports
the ISO Latin-1 range of characters.
<p>
Of the ISO Latin-1 characters (character codes 0x0000 through 0x00FF),
the following are lowercase:
<p>
a b c d e f g h i j k l m n o p q r s t u v w x y z
\u00DF \u00E0 \u00E1 \u00E2 \u00E3 \u00E4 \u00E5 \u00E6 \u00E7
\u00E8 \u00E9 \u00EA \u00EB \u00EC \u00ED \u00EE \u00EF \u00F0
\u00F1 \u00F2 \u00F3 \u00F4 \u00F5 \u00F6 \u00F8 \u00F9 \u00FA
\u00FB \u00FC \u00FD \u00FE \u00FF
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be tested.
<DT><B>Returns:</B><DD><code>true</code> if the character is lowercase;
<code>false</code> otherwise.<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isUpperCase(char)"><!-- --></A><H3>
isUpperCase</H3>
<PRE>
public static boolean <B>isUpperCase</B>(char ch)</PRE>
<DL>
<DD>Determines if the specified character is an uppercase character.
<p>
Note that by default CLDC only supports
the ISO Latin-1 range of characters.
<p>
Of the ISO Latin-1 characters (character codes 0x0000 through 0x00FF),
the following are uppercase:
<p>
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
\u00C0 \u00C1 \u00C2 \u00C3 \u00C4 \u00C5 \u00C6 \u00C7
\u00C8 \u00C9 \u00CA \u00CB \u00CC \u00CD \u00CE \u00CF \u00D0
\u00D1 \u00D2 \u00D3 \u00D4 \u00D5 \u00D6 \u00D8 \u00D9 \u00DA
\u00DB \u00DC \u00DD \u00DE
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be tested.
<DT><B>Returns:</B><DD><code>true</code> if the character is uppercase;
<code>false</code> otherwise.<DT><B>Since:</B></DT>
<DD>1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Character.html#isLowerCase(char)"><CODE>isLowerCase(char)</CODE></A>,
<A HREF="../../java/lang/Character.html#toUpperCase(char)"><CODE>toUpperCase(char)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isDigit(char)"><!-- --></A><H3>
isDigit</H3>
<PRE>
public static boolean <B>isDigit</B>(char ch)</PRE>
<DL>
<DD>Determines if the specified character is a digit.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be tested.
<DT><B>Returns:</B><DD><code>true</code> if the character is a digit;
<code>false</code> otherwise.<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="toLowerCase(char)"><!-- --></A><H3>
toLowerCase</H3>
<PRE>
public static char <B>toLowerCase</B>(char ch)</PRE>
<DL>
<DD>The given character is mapped to its lowercase equivalent; if the
character has no lowercase equivalent, the character itself is
returned.
<p>
Note that by default CLDC only supports
the ISO Latin-1 range of characters.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be converted.
<DT><B>Returns:</B><DD>the lowercase equivalent of the character, if any;
otherwise the character itself.<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Character.html#isLowerCase(char)"><CODE>isLowerCase(char)</CODE></A>,
<A HREF="../../java/lang/Character.html#isUpperCase(char)"><CODE>isUpperCase(char)</CODE></A>,
<A HREF="../../java/lang/Character.html#toUpperCase(char)"><CODE>toUpperCase(char)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="toUpperCase(char)"><!-- --></A><H3>
toUpperCase</H3>
<PRE>
public static char <B>toUpperCase</B>(char ch)</PRE>
<DL>
<DD>Converts the character argument to uppercase; if the
character has no uppercase equivalent, the character itself is
returned.
<p>
Note that by default CLDC only supports
the ISO Latin-1 range of characters.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be converted.
<DT><B>Returns:</B><DD>the uppercase equivalent of the character, if any;
otherwise the character itself.<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Character.html#isLowerCase(char)"><CODE>isLowerCase(char)</CODE></A>,
<A HREF="../../java/lang/Character.html#isUpperCase(char)"><CODE>isUpperCase(char)</CODE></A>,
<A HREF="../../java/lang/Character.html#toLowerCase(char)"><CODE>toLowerCase(char)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="digit(char, int)"><!-- --></A><H3>
digit</H3>
<PRE>
public static int <B>digit</B>(char ch,
int radix)</PRE>
<DL>
<DD>Returns the numeric value of the character <code>ch</code> in the
specified radix.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - the character to be converted.<DD><CODE>radix</CODE> - the radix.
<DT><B>Returns:</B><DD>the numeric value represented by the character in the
specified radix.<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Character.html#isDigit(char)"><CODE>isDigit(char)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="valueOf(char)"><!-- --></A><H3>
valueOf</H3>
<PRE>
public static <A HREF="../../java/lang/Character.html" title="class in java.lang">Character</A> <B>valueOf</B>(char val)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Character.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
"<p style=\"background-color:${javadoc.bgcolor}; color:${javadoc.fgcolor}; padding:4px 5px 2px 3px; margin-top:-1px\"><b>2013 FRC Java API</b></p>"</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Byte.html" title="class in java.lang"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Class.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?java/lang/Character.html" target="_top"><B>FRAMES</B></A>
<A HREF="Character.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
"<center><i><font size=\"-1\">For updated information see the <a href=\"http://www.usfirst.org/roboticsprograms/frc/\">Java FRC site</a></font></i></center>"
</BODY>
</HTML>
| {
"content_hash": "a2442df7fbe9fd34326d9b6bcb925054",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 385,
"avg_line_length": 41.145114942528735,
"alnum_prop": 0.6315256486363795,
"repo_name": "VulcanRobotics/Vector",
"id": "ea5ccbc42098959937c48349871883be43b54d5a",
"size": "28637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/java/lang/Character.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1420"
},
{
"name": "Java",
"bytes": "61426"
}
],
"symlink_target": ""
} |
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Cordova, Plugin } from './plugin';
/**
* @name Device Orientation
* @description
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
*
* @usage
* ```typescript
* // CompassHeading is an interface for compass
* import { DeviceOrientation, CompassHeading } from 'ionic-native';
*
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* (data: CompassHeading) => console.log(data),
* (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* (data: CompassHeading) => console.log(data)
* );
*
* // Stop watching heading change
* subscription.unsubscribe();
* ```
* @interfaces
* DeviceOrientationCompassOptions
* DeviceOrientationCompassHeading
*/
export var DeviceOrientation = (function () {
function DeviceOrientation() {
}
/**
* Get the current compass heading.
* @returns {Promise<DeviceOrientationCompassHeading>}
*/
DeviceOrientation.getCurrentHeading = function () { return; };
/**
* Get the device current heading at a regular interval
*
* Stop the watch by unsubscribing from the observable
* @param {DeviceOrientationCompassOptions} options Options for compass. Frequency and Filter. Optional
* @returns {Observable<DeviceOrientationCompassHeading>} Returns an observable that contains the compass heading
*/
DeviceOrientation.watchHeading = function (options) { return; };
__decorate([
Cordova()
], DeviceOrientation, "getCurrentHeading", null);
__decorate([
Cordova({
callbackOrder: 'reverse',
observable: true,
clearFunction: 'clearWatch'
})
], DeviceOrientation, "watchHeading", null);
DeviceOrientation = __decorate([
Plugin({
pluginName: 'DeviceOrientation',
plugin: 'cordova-plugin-device-orientation',
pluginRef: 'navigator.compass',
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
})
], DeviceOrientation);
return DeviceOrientation;
}());
//# sourceMappingURL=deviceorientation.js.map | {
"content_hash": "f7904807365ad3e8065febe4367570e0",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 182,
"avg_line_length": 41,
"alnum_prop": 0.6441697293685266,
"repo_name": "Spect-AR/Spect-AR",
"id": "b4470d202eb884340d983c4d3a9eb63a5b6467e7",
"size": "2993",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "node_modules/ionic-native/dist/esm/plugins/deviceorientation.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "17908"
},
{
"name": "C",
"bytes": "4939"
},
{
"name": "C#",
"bytes": "108433"
},
{
"name": "C++",
"bytes": "250150"
},
{
"name": "CSS",
"bytes": "939720"
},
{
"name": "HTML",
"bytes": "14446"
},
{
"name": "Java",
"bytes": "1009594"
},
{
"name": "JavaScript",
"bytes": "10120701"
},
{
"name": "Objective-C",
"bytes": "1665747"
},
{
"name": "QML",
"bytes": "3734"
},
{
"name": "Shell",
"bytes": "1927"
},
{
"name": "TypeScript",
"bytes": "12363"
}
],
"symlink_target": ""
} |
package com.miraclewong.viewpagertest;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import java.util.List;
public class MyFragmentPagerAdapter2 extends FragmentStatePagerAdapter {
private List<Fragment> fragList;
private List<String> titleList;
public MyFragmentPagerAdapter2(FragmentManager fm, List<Fragment> fragList, List<String> titleList) {
super(fm);
// TODO Auto-generated constructor stub
this.fragList = fragList;
this.titleList = titleList;
}
@Override
public Fragment getItem(int arg0) {
// TODO Auto-generated method stub
return fragList.get(arg0);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return fragList.size();
}
@Override
public CharSequence getPageTitle(int position) {
// TODO Auto-generated method stub
return titleList.get(position);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
return super.instantiateItem(container, position);
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
super.destroyItem(container, position, object);
}
}
| {
"content_hash": "2e99c3bc15871a18a61d49fc4731490c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 105,
"avg_line_length": 27.897959183673468,
"alnum_prop": 0.7008046817849305,
"repo_name": "MiracleWong/AndroidAdvancedWidget",
"id": "df653b92c318031b17bc3fc4670fe9200e4228f1",
"size": "1367",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "viewpagertest/src/main/java/com/miraclewong/viewpagertest/MyFragmentPagerAdapter2.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "55892"
}
],
"symlink_target": ""
} |
namespace spirea {
namespace detail { namespace {
struct ihdr_t
{
png_uint_32 width, height;
int bit_depth;
int color_type;
int interlace_method;
int compression_method;
int filter_method;
};
template <typename Image>
constexpr int get_color_space() noexcept
{
using color_type = typename Image::color_type;
if constexpr( mp::equal_set_v< color_type, rgb > ) {
return PNG_COLOR_TYPE_RGB;
}
else if constexpr( mp::equal_set_v< color_type, rgba > ) {
return PNG_COLOR_TYPE_RGB_ALPHA;
}
else if constexpr( mp::equal_set_v< color_type, gray_scale > ) {
return PNG_COLOR_TYPE_GRAY;
}
else if constexpr( mp::equal_set_v< color_type, index_color > ) {
return PNG_COLOR_TYPE_PALETTE;
}
else {
return 0;
}
}
template <typename Color>
using get_png_color_space_type = std::conditional_t<
mp::equal_set_v< Color, rgb >, rgb, std::conditional_t<
mp::equal_set_v< Color, rgba >, rgba,
Color
> >;
class png_reader
{
png_structp png_ptr_;
png_infop info_ptr_;
png_infop end_info_ptr_;
public:
using image_type = std::variant<
image< rgb, std::uint8_t >,
image< rgba, std::uint8_t >
>;
png_reader()
{
png_ptr_ = png_create_read_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr );
if( !png_ptr_ ){
throw std::bad_alloc();
}
info_ptr_ = png_create_info_struct( png_ptr_ );
if( !info_ptr_ ) {
png_destroy_read_struct( &png_ptr_, nullptr, nullptr );
throw std::bad_alloc();
}
end_info_ptr_ = png_create_info_struct( png_ptr_ );
if( !end_info_ptr_ ) {
png_destroy_read_struct( &png_ptr_, &end_info_ptr_, nullptr );
throw std::bad_alloc();
}
#if defined( PNG_SKIP_sRGB_CHECK_PROFILE ) && defined( PNG_SET_OPTION_SUPPORTED )
png_set_option( png_ptr_, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON );
#endif
}
~png_reader()
{
if( png_ptr_ && info_ptr_ && end_info_ptr_ ) {
png_destroy_read_struct( &png_ptr_, &info_ptr_, &end_info_ptr_ );
}
}
result< image_type, std::exception > read(file_r& fp)
{
if( !compare_sig( fp ) ) {
return std::runtime_error( "invalid file signature" );
}
if( !start( fp, png_ptr_, info_ptr_ ) ) {
return std::runtime_error( "read png file failed" );
}
ihdr_t ihdr;
if( !get_ihdr( png_ptr_, info_ptr_, ihdr ) ) {
return std::runtime_error( "png_reader::get_ihdr failed" );
}
result< image_type, std::exception > res;
std::vector< png_bytep > row_ptrs( ihdr.height );
if( ihdr.color_type == PNG_COLOR_TYPE_RGB ) {
auto img = make_image< rgb, std::uint8_t >( ihdr.width, ihdr.height );
if( !read_data( png_ptr_, img, row_ptrs ) ) {
return std::runtime_error( "png_reader::read_data failed" );
}
res = result< image_type, std::exception >( image_type( std::move( img ) ) );
}
else if( ihdr.color_type == PNG_COLOR_TYPE_RGBA ) {
auto img = make_image< rgba, std::uint8_t >( ihdr.width, ihdr.height );
if( !read_data( png_ptr_, img, row_ptrs ) ) {
return std::runtime_error( "png_reader::read_data failed" );
}
res = result< image_type, std::exception >( image_type( std::move( img ) ) );
}
if( !end( png_ptr_, end_info_ptr_ ) ) {
return std::runtime_error( "png_reader::end failed" );
}
return res;
}
private:
static bool compare_sig(file_r& fp) noexcept
{
std::uint8_t sig[8];
fp.read( sig, 8 );
return png_sig_cmp( sig, 0, 8 ) == 0;
}
static bool start(file_r& fp, png_structp png_ptr, png_infop info_ptr) noexcept
{
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_init_io( png_ptr, fp.data().get() );
png_set_sig_bytes( png_ptr, 8 );
png_read_info( png_ptr, info_ptr );
return true;
}
static bool get_ihdr(png_structp png_ptr, png_infop info_ptr, ihdr_t& data) noexcept
{
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_get_IHDR(
png_ptr, info_ptr,
&data.width, &data.height, &data.bit_depth, &data.color_type,
&data.interlace_method, &data.compression_method, &data.filter_method
);
return true;
}
template <typename Image>
static bool read_data(png_structp png_ptr, Image& img, std::vector< png_bytep >& row_ptrs) noexcept
{
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
for( std::size_t i = 0; i < row_ptrs.size(); ++i ) {
row_ptrs[i] = img( 0, i ).data();
}
png_read_image( png_ptr, row_ptrs.data() );
return true;
}
static bool end(png_structp png_ptr, png_infop end_info_ptr) noexcept
{
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_read_end( png_ptr, end_info_ptr );
return true;
}
};
class png_writer
{
png_structp png_ptr_;
png_infop info_ptr_;
public:
png_writer()
{
png_ptr_ = png_create_write_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr );
if( !png_ptr_ ) {
throw std::bad_alloc();
}
info_ptr_ = png_create_info_struct( png_ptr_ );
if( !info_ptr_ ) {
png_destroy_write_struct( &png_ptr_, nullptr );
throw std::bad_alloc();
}
}
~png_writer()
{
if( png_ptr_ && info_ptr_ ) {
png_destroy_write_struct( &png_ptr_, &info_ptr_ );
}
}
template <typename Image>
result< void, std::exception > write(file_w& fp, Image const& img, bool interlace)
{
if( !start( fp, png_ptr_, info_ptr_, img, interlace ) ) {
return std::runtime_error( "png_writer::start failed" );
}
std::vector< typename Image::value_type > buf( img.width() * img.dimensions() );
if( !write_data( png_ptr_, info_ptr_, img, interlace, buf ) ) {
return std::runtime_error( "png_writer::write_data failed" );
}
if( !end( png_ptr_, info_ptr_ ) ) {
return std::runtime_error( "png_writer::end failed" );
}
return {};
}
private:
template <typename Image>
static bool start(file_w& fp, png_structp png_ptr, png_infop info_ptr, Image const& img, bool interlace) noexcept
{
constexpr auto color_space = get_color_space< Image >();
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_init_io( png_ptr, fp.data().get() );
png_set_IHDR(
png_ptr, info_ptr,
img.width(), img.height(), sizeof( typename Image::value_type ) * 8, color_space,
interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT
);
return true;
}
template <typename Image>
static bool write_data(png_structp png_ptr, png_infop info_ptr, Image const& img, bool interlace, std::vector< typename Image::value_type >& buf) noexcept
{
using color_type = get_png_color_space_type< typename Image::color_type >;
using value_type = typename Image::value_type;
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_write_info( png_ptr, info_ptr );
if( !interlace ) {
for( std::size_t y = 0; y < img.height(); ++y ) {
color_data_array_iterator< color_type, value_type > r = { buf.data() };
for( std::size_t x = 0; x < img.width(); ++x ) {
*r++ = img( x, y );
}
png_write_row( png_ptr, buf.data() );
}
}
else {
for( std::size_t y = 0; y < img.height(); ++y ) {
color_data_array_iterator< color_type, value_type > r = { buf.data() };
for( std::size_t x = 0; x < img.width(); ++x ) {
*r++ = img( x, y );
}
int const pass_cnt = png_set_interlace_handling( png_ptr );
for( int i = 0; i < pass_cnt; ++i ) {
auto bufp = buf.data();
png_write_rows( png_ptr, &bufp, 1 );
}
}
}
return true;
}
static bool end(png_structp png_ptr, png_infop info_ptr)
{
if( setjmp( png_jmpbuf( png_ptr ) ) ) {
return false;
}
png_write_end( png_ptr, info_ptr );
return true;
}
};
} } // namespace detail
class png
{
public:
using image_type = typename detail::png_reader::image_type;
static result< image_type, std::exception > read(std::string_view filename)
{
auto fp = file_r::open( filename );
if( !fp ) {
return move_error( fp );
}
detail::png_reader reader;
return reader.read( *fp );
}
template <typename Image>
static result< void, std::exception > write(std::string_view filename, Image const& img, bool interlace = false)
{
auto fp = file_w::open( filename );
if( !fp ) {
return move_error( fp );
}
detail::png_writer writer;
return writer.write( *fp, img, interlace );
}
};
} // namespace spirea
#endif // SPIREA_IMAGE_IO_PNG_HPP_ | {
"content_hash": "a8e62e226d92d053cb1bbbbff1672246",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 156,
"avg_line_length": 24.52449567723343,
"alnum_prop": 0.5989424206815511,
"repo_name": "LNSEAB/spirea",
"id": "7fa16b0cb320460a1b942a29393c54473bb70be3",
"size": "9051",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/spirea/image/io/png.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "1086840"
},
{
"name": "Makefile",
"bytes": "921"
},
{
"name": "Shell",
"bytes": "5169"
}
],
"symlink_target": ""
} |
Net-Ganeti
==========
Control your Ganeti cluster with Perl
| {
"content_hash": "660ed5858f109a410b118dbfe388b0c2",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 15.5,
"alnum_prop": 0.6612903225806451,
"repo_name": "jorisd/Net-Ganeti",
"id": "5488bf6824be468b98f67c60956ead3891269ce3",
"size": "62",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Perl",
"bytes": "11880"
}
],
"symlink_target": ""
} |
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Approve.RuleCenter;
using Approve.Common;
using Approve.EntityBase;
using Approve.RuleBase;
public partial class Share_User_ManUserList : Page
{
Share sh = new Share();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ControlBind();
btnDel.Attributes.Add("onclick", "return confirm('确认要删除么?');");
ShowInfo();
}
}
private void ControlBind()
{
StringBuilder sb = new StringBuilder();
sb.Append("select * from CF_Sys_MenuRole ");
sb.Append("where FType=1 and fisdeleted=0 order by fnumber ");
DataTable dt = sh.GetTable(sb.ToString());
t_FMenuRoleId.DataSource = dt;
t_FMenuRoleId.DataTextField = "FName";
t_FMenuRoleId.DataValueField = "FNumber";
t_FMenuRoleId.DataBind();
t_FMenuRoleId.Items.Insert(0, new ListItem("请选择", ""));
Govdept1.fNumber = ComFunction.GetDefaultCityDept();
Govdept1.Dis(1);
}
//条件
private string GetCon()
{
string fDeptNumber = this.Govdept1.FNumber;
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrEmpty(t_FEntName.Text))
{
sb.Append(" and fName like '%" + t_FEntName.Text + "%'");
}
if (fDeptNumber != null && fDeptNumber != "")
{
sb.Append(" and FManageDeptId like '" + fDeptNumber + "%'");
}
if (!string.IsNullOrEmpty(t_FLockNumber.Text))
{
sb.Append(" and FLockNumber like '%" + t_FLockNumber.Text + "%'");
}
if (!string.IsNullOrEmpty(t_FMenuRoleId.SelectedValue))
{
sb.Append(" and FMenuRoleId ='" + t_FMenuRoleId.SelectedValue + "'");
}
return sb.ToString();
}
private void ShowInfo()
{
StringBuilder sb = new StringBuilder();
sb.Append(" select FId,FCompany,FName,FLockNumber,FMenuRoleId,FTel,ftype,FManageDeptId ");
sb.Append(" From cf_sys_user ");
sb.Append(" where FIsDeleted=0 ");
sb.Append(GetCon());
sb.Append(" And FType=6 ");//ftype=6:系统管理员用户
sb.Append(" Order By Fcreatetime Desc");
this.Pager1.className = "dbShare";
this.Pager1.sql = sb.ToString();
this.Pager1.pagecount = 20;
this.Pager1.controltopage = "DG_List";
this.Pager1.controltype = "DataGrid";
this.Pager1.dataBind();
}
protected void DG_List_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemIndex > -1)
{
e.Item.Cells[1].Text = (e.Item.ItemIndex + 1 + this.Pager1.pagecount * (this.Pager1.curpage - 1)).ToString();
string FID = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FID"));
string FManageDeptId = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FManageDeptId"));
string FMenuRoleId = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FMenuRoleId"));
//角色
e.Item.Cells[4].Text = sh.GetSignValue("select FName from CF_Sys_MenuRole where FNumber='" + FMenuRoleId + "'");
//主管部门
e.Item.Cells[5].Text = sh.getDept(FManageDeptId, 1);
e.Item.Attributes.Add("ondblclick", "showAddWindow('SysUserAdd.aspx?FID=" + FID + "&fmatypeid=" + Request.QueryString["fmatypeid"] + "' ,700,500);");
}
}
protected void btnQuery_Click(object sender, EventArgs e)
{
ShowInfo();
}
protected void btnDel_Click(object sender, EventArgs e)
{
pageTool tool = new pageTool(this.Page);
SortedList sl = new SortedList();
sl.Add("CF_Sys_User", "FID");
tool.DelInfoFromGrid(this.DG_List, sl, "dbShare");
ShowInfo();
}
}
| {
"content_hash": "db1f74336c522dd3b3044136a4db6901",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 161,
"avg_line_length": 31.6046511627907,
"alnum_prop": 0.6033848417954378,
"repo_name": "coojee2012/pm3",
"id": "e300e408aac59c3f4d360c258a3a0faa84065d98",
"size": "4129",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SurveyDesign/Share/User/SysUserList.aspx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "11226984"
},
{
"name": "C#",
"bytes": "13305364"
},
{
"name": "CSS",
"bytes": "170205"
},
{
"name": "HTML",
"bytes": "732666"
},
{
"name": "Java",
"bytes": "3209"
},
{
"name": "JavaScript",
"bytes": "613169"
},
{
"name": "PHP",
"bytes": "4866"
},
{
"name": "PLpgSQL",
"bytes": "1028"
},
{
"name": "SQLPL",
"bytes": "2830"
},
{
"name": "Visual Basic",
"bytes": "67805"
},
{
"name": "XSLT",
"bytes": "4122"
}
],
"symlink_target": ""
} |
package blackberry.io.dir;
import java.util.Enumeration;
import javax.microedition.io.file.FileSystemRegistry;
import blackberry.core.ScriptableFunctionBase;
/**
* JavaScript function class - retrieves the root directories available
*/
public final class GetRootDirsFunction extends ScriptableFunctionBase {
public static final String NAME = "getRootDirs";
/**
* JavaScript extension function; determine the path of the root directories.
*
* @return a list of complete URL paths to the root directories.
*/
public Object execute( Object thiz, Object[] args ) throws Exception {
String[] dirList = null;
Enumeration rootEnum = FileSystemRegistry.listRoots();
int count = 0;
while( rootEnum.hasMoreElements() ) { // get the number of root dirs
String rootDir = (String) rootEnum.nextElement();
if( rootDir != null && !rootDir.equals( "system/" ) ) {
count++;
}
}
if( count == 0 ) {
return UNDEFINED;
}
dirList = new String[ count ];
rootEnum = FileSystemRegistry.listRoots();
for( int i = 0; i < count; ) {
// MKS360365 - don't return "file:///system" - nobody can use it anyway
String rootDir = (String) rootEnum.nextElement();
if( rootDir != null && !rootDir.equals( "system/" ) ) {
dirList[ i ] = "file:///" + rootDir;
i++;
}
}
return dirList;
}
}
| {
"content_hash": "116b069a1c24c5c25d985ee94bf1d659",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.5670426065162907,
"repo_name": "marek/WebWorks",
"id": "e9c99a5cf6274a7c91cd8659f666a6c5074584b8",
"size": "2207",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/io/src/blackberry/io/dir/GetRootDirsFunction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
simple-metronome
================
An amateurish metronome I did a very, very long time ago. GUI allows for tempo & time signature configuration.
| {
"content_hash": "6a043491b0c910f966d5ca9c523f1227",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 110,
"avg_line_length": 36.5,
"alnum_prop": 0.7054794520547946,
"repo_name": "g-andrade/simple-metronome",
"id": "e27ea227745ff971cbcd381b054d467181aa0644",
"size": "146",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "6247"
},
{
"name": "Shell",
"bytes": "70"
}
],
"symlink_target": ""
} |
namespace lug {
namespace Graphics {
namespace Vulkan {
namespace API {
DescriptorPool::DescriptorPool(VkDescriptorPool descriptorPool, const Device* device) : _descriptorPool(descriptorPool), _device(device) {}
DescriptorPool::DescriptorPool(DescriptorPool&& descriptorPool) {
_descriptorPool = descriptorPool._descriptorPool;
_device = descriptorPool._device;
descriptorPool._descriptorPool = VK_NULL_HANDLE;
descriptorPool._device = nullptr;
}
DescriptorPool& DescriptorPool::operator=(DescriptorPool&& descriptorPool) {
destroy();
_descriptorPool = descriptorPool._descriptorPool;
_device = descriptorPool._device;
descriptorPool._descriptorPool = VK_NULL_HANDLE;
descriptorPool._device = nullptr;
return *this;
}
DescriptorPool::~DescriptorPool() {
destroy();
}
void DescriptorPool::destroy() {
if (_descriptorPool != VK_NULL_HANDLE) {
vkDestroyDescriptorPool(static_cast<VkDevice>(*_device), _descriptorPool, nullptr);
_descriptorPool = VK_NULL_HANDLE;
}
_device = nullptr;
}
} // API
} // Vulkan
} // Graphics
} // lug
| {
"content_hash": "ce1da69b85b13fbccc466be0e6207670",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 139,
"avg_line_length": 25.204545454545453,
"alnum_prop": 0.715058611361587,
"repo_name": "Lugdunum3D/Lugdunum",
"id": "cecb62b826e4000b2b8e3622e684532301e3f9f6",
"size": "1211",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/lug/Graphics/Vulkan/API/DescriptorPool.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "250035"
},
{
"name": "C++",
"bytes": "1214736"
},
{
"name": "CMake",
"bytes": "58251"
},
{
"name": "GLSL",
"bytes": "30705"
},
{
"name": "PowerShell",
"bytes": "2591"
},
{
"name": "Shell",
"bytes": "4441"
}
],
"symlink_target": ""
} |
import test from 'tape-catch';
import testUtils from 'vtk.js/Sources/Testing/testUtils';
import vtkColorTransferFunction from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction';
import vtkHttpDataSetReader from 'vtk.js/Sources/IO/Core/HttpDataSetReader';
import 'vtk.js/Sources/Rendering/Misc/RenderingAPIs';
import vtkPiecewiseFunction from 'vtk.js/Sources/Common/DataModel/PiecewiseFunction';
import vtkRenderWindow from 'vtk.js/Sources/Rendering/Core/RenderWindow';
import vtkRenderWindowInteractor from 'vtk.js/Sources/Rendering/Core/RenderWindowInteractor';
import vtkRenderer from 'vtk.js/Sources/Rendering/Core/Renderer';
import vtkVolume from 'vtk.js/Sources/Rendering/Core/Volume';
import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper';
import Constants from 'vtk.js/Sources/Rendering/Core/VolumeMapper/Constants';
import baseline from './testAverageIntensityProjection.png';
test.skip('Test Average Intensity Projection Volume Rendering', (t) => {
const gc = testUtils.createGarbageCollector(t);
t.ok('rendering', 'vtkVolumeMapper AverageIP');
// testUtils.keepDOM();
// Create some control UI
const container = document.querySelector('body');
const renderWindowContainer = gc.registerDOMElement(
document.createElement('div')
);
container.appendChild(renderWindowContainer);
// create what we will view
const renderWindow = gc.registerResource(vtkRenderWindow.newInstance());
const renderer = gc.registerResource(vtkRenderer.newInstance());
renderWindow.addRenderer(renderer);
renderer.setBackground(0.32, 0.34, 0.43);
const actor = gc.registerResource(vtkVolume.newInstance());
const mapper = gc.registerResource(vtkVolumeMapper.newInstance());
mapper.setSampleDistance(0.7);
mapper.setBlendMode(Constants.BlendMode.AVERAGE_INTENSITY_BLEND);
actor.setMapper(mapper);
const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });
// create color and opacity transfer functions
const ctfun = vtkColorTransferFunction.newInstance();
ctfun.addRGBPoint(-3024, 0, 0, 0);
ctfun.addRGBPoint(-637.62, 1, 1, 1);
ctfun.addRGBPoint(700, 1, 1, 1);
ctfun.addRGBPoint(3071, 1, 1, 1);
ctfun.setMappingRange(500, 3000);
const ofun = vtkPiecewiseFunction.newInstance();
ofun.addPoint(-3024, 0);
ofun.addPoint(-637.62, 0);
ofun.addPoint(700, 0.5);
ofun.addPoint(3071, 0.9);
actor.getProperty().setRGBTransferFunction(0, ctfun);
actor.getProperty().setScalarOpacity(0, ofun);
actor.getProperty().setScalarOpacityUnitDistance(0, 4.5);
actor.getProperty().setInterpolationTypeToFastLinear();
mapper.setInputConnection(reader.getOutputPort());
// now create something to view it
const glwindow = gc.registerResource(renderWindow.newAPISpecificView());
glwindow.setContainer(renderWindowContainer);
renderWindow.addView(glwindow);
glwindow.setSize(400, 400);
// Interactor
const interactor = vtkRenderWindowInteractor.newInstance();
interactor.setStillUpdateRate(0.01);
interactor.setView(glwindow);
interactor.initialize();
interactor.bindEvents(renderWindowContainer);
reader.setUrl(`${__BASE_PATH__}/Data/volume/headsq.vti`).then(() => {
reader.loadData().then(() => {
renderer.addVolume(actor);
renderer.resetCamera();
glwindow.captureNextImage().then((image) => {
testUtils.compareImages(
image,
[baseline],
'Rendering/Core/VolumeMapper/testAverageIntensityProjection',
t,
{
// be stricter here
pixelThreshold: 0.01,
mismatchTolerance: 1.0,
},
gc.releaseResources
);
});
renderWindow.render();
});
});
});
| {
"content_hash": "fdcf357836cc31ed83d00ca90890f8cf",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 93,
"avg_line_length": 36.71287128712871,
"alnum_prop": 0.7348975188781014,
"repo_name": "Kitware/vtk-js",
"id": "49ed07754cc61609487ddaae4f922aefdf4830c5",
"size": "3708",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sources/Rendering/Core/VolumeMapper/test/testAverageIntensityProjection.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "6475"
},
{
"name": "GLSL",
"bytes": "88494"
},
{
"name": "HTML",
"bytes": "68637"
},
{
"name": "JavaScript",
"bytes": "4544289"
},
{
"name": "Python",
"bytes": "75108"
},
{
"name": "Shell",
"bytes": "4047"
}
],
"symlink_target": ""
} |
class CreateWatchedEpisodes < ActiveRecord::Migration
def change
create_table :watched_episodes do |t|
t.references :user, index: true, foreign_key: true
t.references :episode, index: true, foreign_key: true
t.timestamps null: false
end
end
end
| {
"content_hash": "7bde7cac3b2df3f4f6d67c62d25238cd",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 59,
"avg_line_length": 27.6,
"alnum_prop": 0.6992753623188406,
"repo_name": "NextEpisode/NextEpisode",
"id": "c1c736d39837a3af862021bd965953d7f9942068",
"size": "276",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20150424165623_create_watched_episodes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "64146"
},
{
"name": "CoffeeScript",
"bytes": "5297"
},
{
"name": "HTML",
"bytes": "81542"
},
{
"name": "JavaScript",
"bytes": "1243"
},
{
"name": "Ruby",
"bytes": "149037"
}
],
"symlink_target": ""
} |
<div class="navbar navbar-default " role="navigation">
<div class="container">
<div class="navbar-header ">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">ngStartup</span></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">ngStartup</a>
</div>
<div class="navbar-collapse collapse navbar-right">
<ul class=" nav navbar-nav">
<li ng-class="{'active': state.name == 'home'}"><a ui-sref="home">Home</a></li>
<li><a href="http://ngstartup.corleycloud.com/documentation/latest.html">Documentation</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
| {
"content_hash": "c3fd0c884f5bf086b689bfcc18941227",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 114,
"avg_line_length": 43.421052631578945,
"alnum_prop": 0.6,
"repo_name": "corley/ng-startup",
"id": "27585aa8e7b76db00ad4084c2f4742fcebf6ab47",
"size": "826",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/common/layout/header.tpl.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11933"
},
{
"name": "HTML",
"bytes": "4535"
},
{
"name": "JavaScript",
"bytes": "41089"
}
],
"symlink_target": ""
} |
pywikibot.data package
======================
.. automodule:: pywikibot.data
Submodules
----------
pywikibot.data.api module
-------------------------
.. automodule:: pywikibot.data.api
pywikibot.data.mysql module
---------------------------
.. automodule:: pywikibot.data.mysql
pywikibot.data.sparql module
----------------------------
.. automodule:: pywikibot.data.sparql
pywikibot.data.wikistats module
-------------------------------
.. automodule:: pywikibot.data.wikistats
| {
"content_hash": "0d28646540f07882ec5abd03b30373d2",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 40,
"avg_line_length": 16.96551724137931,
"alnum_prop": 0.5426829268292683,
"repo_name": "PersianWikipedia/pywikibot-core",
"id": "038c439bdd029a4f31493b9bef925a805c6f7f1a",
"size": "492",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/api_ref/pywikibot.data.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "97"
},
{
"name": "Python",
"bytes": "4021871"
}
],
"symlink_target": ""
} |
package it.cnr.isti.zigbee.util;
/**
*
* @author <a href="mailto:stefano.lenzi@isti.cnr.it">Stefano "Kismet" Lenzi</a>
* @author <a href="mailto:francesco.furfari@isti.cnr.it">Francesco Furfari</a>
* @version $LastChangedRevision$ ($LastChangedDate$)
* @since 0.1.0
*
*/
public class NetworkAddress {
public static final short fromDecimal(int value){
return (short) value;
}
public static final short fromString(String value){
return Short.decode(value);
}
public static final int toDecimal(short nwk){
if(nwk>=0) {
return nwk;
} else {
return 0x0000FFFF & nwk;
}
}
public static final String toHex(short nwk){
return toString(nwk);
}
public static final String toString(short nwk){
String padding = "0000";
String hex = Integer.toHexString(nwk);
if(hex.length()>4){
hex = hex.substring(hex.length()-4);
}else{
hex = padding.substring(0,4-hex.length())+hex;
}
return "0x"+hex.toUpperCase();
}
}
| {
"content_hash": "cdc8e881e3ec183bfa065cda6c487219",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 80,
"avg_line_length": 20.229166666666668,
"alnum_prop": 0.6673532440782698,
"repo_name": "cdealti/zb4osgi",
"id": "2dc13b1e92ba7c0929356ce6f0173ed04bb43bb3",
"size": "1790",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "zb4o-basedriver/src/main/java/it/cnr/isti/zigbee/util/NetworkAddress.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3676977"
}
],
"symlink_target": ""
} |
package cloudidentity // import "google.golang.org/api/cloudidentity/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
internal "google.golang.org/api/internal"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
internaloption "google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
const apiId = "cloudidentity:v1"
const apiName = "cloudidentity"
const apiVersion = "v1"
const basePath = "https://cloudidentity.googleapis.com/"
const mtlsBasePath = "https://cloudidentity.mtls.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// Private Service:
// https://www.googleapis.com/auth/cloud-identity.devices
CloudIdentityDevicesScope = "https://www.googleapis.com/auth/cloud-identity.devices"
// See your device details
CloudIdentityDevicesLookupScope = "https://www.googleapis.com/auth/cloud-identity.devices.lookup"
// Private Service:
// https://www.googleapis.com/auth/cloud-identity.devices.readonly
CloudIdentityDevicesReadonlyScope = "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// See, change, create, and delete any of the Cloud Identity Groups that
// you can access, including the members of each group
CloudIdentityGroupsScope = "https://www.googleapis.com/auth/cloud-identity.groups"
// See any Cloud Identity Groups that you can access, including group
// members and their emails
CloudIdentityGroupsReadonlyScope = "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
// See, edit, configure, and delete your Google Cloud data and see the
// email address for your Google Account.
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := internaloption.WithDefaultScopes(
"https://www.googleapis.com/auth/cloud-identity.devices",
"https://www.googleapis.com/auth/cloud-identity.devices.lookup",
"https://www.googleapis.com/auth/cloud-identity.devices.readonly",
"https://www.googleapis.com/auth/cloud-identity.groups",
"https://www.googleapis.com/auth/cloud-identity.groups.readonly",
"https://www.googleapis.com/auth/cloud-platform",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Customers = NewCustomersService(s)
s.Devices = NewDevicesService(s)
s.Groups = NewGroupsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Customers *CustomersService
Devices *DevicesService
Groups *GroupsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewCustomersService(s *Service) *CustomersService {
rs := &CustomersService{s: s}
rs.Userinvitations = NewCustomersUserinvitationsService(s)
return rs
}
type CustomersService struct {
s *Service
Userinvitations *CustomersUserinvitationsService
}
func NewCustomersUserinvitationsService(s *Service) *CustomersUserinvitationsService {
rs := &CustomersUserinvitationsService{s: s}
return rs
}
type CustomersUserinvitationsService struct {
s *Service
}
func NewDevicesService(s *Service) *DevicesService {
rs := &DevicesService{s: s}
rs.DeviceUsers = NewDevicesDeviceUsersService(s)
return rs
}
type DevicesService struct {
s *Service
DeviceUsers *DevicesDeviceUsersService
}
func NewDevicesDeviceUsersService(s *Service) *DevicesDeviceUsersService {
rs := &DevicesDeviceUsersService{s: s}
rs.ClientStates = NewDevicesDeviceUsersClientStatesService(s)
return rs
}
type DevicesDeviceUsersService struct {
s *Service
ClientStates *DevicesDeviceUsersClientStatesService
}
func NewDevicesDeviceUsersClientStatesService(s *Service) *DevicesDeviceUsersClientStatesService {
rs := &DevicesDeviceUsersClientStatesService{s: s}
return rs
}
type DevicesDeviceUsersClientStatesService struct {
s *Service
}
func NewGroupsService(s *Service) *GroupsService {
rs := &GroupsService{s: s}
rs.Memberships = NewGroupsMembershipsService(s)
return rs
}
type GroupsService struct {
s *Service
Memberships *GroupsMembershipsService
}
func NewGroupsMembershipsService(s *Service) *GroupsMembershipsService {
rs := &GroupsMembershipsService{s: s}
return rs
}
type GroupsMembershipsService struct {
s *Service
}
// CancelUserInvitationRequest: Request to cancel sent invitation for
// target email in UserInvitation.
type CancelUserInvitationRequest struct {
}
// CheckTransitiveMembershipResponse: The response message for
// MembershipsService.CheckTransitiveMembership.
type CheckTransitiveMembershipResponse struct {
// HasMembership: Response does not include the possible roles of a
// member since the behavior of this rpc is not all-or-nothing unlike
// the other rpcs. So, it may not be possible to list all the roles
// definitively, due to possible lack of authorization in some of the
// paths.
HasMembership bool `json:"hasMembership,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "HasMembership") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "HasMembership") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CheckTransitiveMembershipResponse) MarshalJSON() ([]byte, error) {
type NoMethod CheckTransitiveMembershipResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CreateGroupMetadata: Metadata for CreateGroup LRO.
type CreateGroupMetadata struct {
}
// CreateMembershipMetadata: Metadata for CreateMembership LRO.
type CreateMembershipMetadata struct {
}
// DeleteGroupMetadata: Metadata for DeleteGroup LRO.
type DeleteGroupMetadata struct {
}
// DeleteMembershipMetadata: Metadata for DeleteMembership LRO.
type DeleteMembershipMetadata struct {
}
// DynamicGroupMetadata: Dynamic group metadata like queries and status.
type DynamicGroupMetadata struct {
// Queries: Memberships will be the union of all queries. Only one entry
// with USER resource is currently supported. Customers can create up to
// 100 dynamic groups.
Queries []*DynamicGroupQuery `json:"queries,omitempty"`
// Status: Output only. Status of the dynamic group.
Status *DynamicGroupStatus `json:"status,omitempty"`
// ForceSendFields is a list of field names (e.g. "Queries") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Queries") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DynamicGroupMetadata) MarshalJSON() ([]byte, error) {
type NoMethod DynamicGroupMetadata
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DynamicGroupQuery: Defines a query on a resource.
type DynamicGroupQuery struct {
// Query: Query that determines the memberships of the dynamic group.
// Examples: All users with at least one `organizations.department` of
// engineering. `user.organizations.exists(org,
// org.department=='engineering')` All users with at least one location
// that has `area` of `foo` and `building_id` of `bar`.
// `user.locations.exists(loc, loc.area=='foo' &&
// loc.building_id=='bar')` All users with any variation of the name
// John Doe (case-insensitive queries add `equalsIgnoreCase()` to the
// value being queried). `user.name.value.equalsIgnoreCase('jOhn DoE')`
Query string `json:"query,omitempty"`
// ResourceType: Resource type for the Dynamic Group Query
//
// Possible values:
// "RESOURCE_TYPE_UNSPECIFIED" - Default value (not valid)
// "USER" - For queries on User
ResourceType string `json:"resourceType,omitempty"`
// ForceSendFields is a list of field names (e.g. "Query") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Query") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DynamicGroupQuery) MarshalJSON() ([]byte, error) {
type NoMethod DynamicGroupQuery
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DynamicGroupStatus: The current status of a dynamic group along with
// timestamp.
type DynamicGroupStatus struct {
// Status: Status of the dynamic group.
//
// Possible values:
// "STATUS_UNSPECIFIED" - Default.
// "UP_TO_DATE" - The dynamic group is up-to-date.
// "UPDATING_MEMBERSHIPS" - The dynamic group has just been created
// and memberships are being updated.
// "INVALID_QUERY" - Group is in an unrecoverable state and its
// memberships can't be updated.
Status string `json:"status,omitempty"`
// StatusTime: The latest time at which the dynamic group is guaranteed
// to be in the given status. If status is `UP_TO_DATE`, the latest time
// at which the dynamic group was confirmed to be up-to-date. If status
// is `UPDATING_MEMBERSHIPS`, the time at which dynamic group was
// created.
StatusTime string `json:"statusTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "Status") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Status") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DynamicGroupStatus) MarshalJSON() ([]byte, error) {
type NoMethod DynamicGroupStatus
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// EntityKey: A unique identifier for an entity in the Cloud Identity
// Groups API. An entity can represent either a group with an optional
// `namespace` or a user without a `namespace`. The combination of `id`
// and `namespace` must be unique; however, the same `id` can be used
// with different `namespace`s.
type EntityKey struct {
// Id: The ID of the entity. For Google-managed entities, the `id`
// should be the email address of an existing group or user. For
// external-identity-mapped entities, the `id` must be a string
// conforming to the Identity Source's requirements. Must be unique
// within a `namespace`.
Id string `json:"id,omitempty"`
// Namespace: The namespace in which the entity exists. If not
// specified, the `EntityKey` represents a Google-managed entity such as
// a Google user or a Google Group. If specified, the `EntityKey`
// represents an external-identity-mapped group. The namespace must
// correspond to an identity source created in Admin Console and must be
// in the form of `identitysources/{identity_source}`.
Namespace string `json:"namespace,omitempty"`
// ForceSendFields is a list of field names (e.g. "Id") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Id") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *EntityKey) MarshalJSON() ([]byte, error) {
type NoMethod EntityKey
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ExpiryDetail: The `MembershipRole` expiry details.
type ExpiryDetail struct {
// ExpireTime: The time at which the `MembershipRole` will expire.
ExpireTime string `json:"expireTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "ExpireTime") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ExpireTime") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ExpiryDetail) MarshalJSON() ([]byte, error) {
type NoMethod ExpiryDetail
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GetMembershipGraphMetadata: Metadata of GetMembershipGraphResponse
// LRO. This is currently empty to permit future extensibility.
type GetMembershipGraphMetadata struct {
}
// GetMembershipGraphResponse: The response message for
// MembershipsService.GetMembershipGraph.
type GetMembershipGraphResponse struct {
// AdjacencyList: The membership graph's path information represented as
// an adjacency list.
AdjacencyList []*MembershipAdjacencyList `json:"adjacencyList,omitempty"`
// Groups: The resources representing each group in the adjacency list.
// Each group in this list can be correlated to a 'group' of the
// MembershipAdjacencyList using the 'name' of the Group resource.
Groups []*Group `json:"groups,omitempty"`
// ForceSendFields is a list of field names (e.g. "AdjacencyList") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AdjacencyList") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GetMembershipGraphResponse) MarshalJSON() ([]byte, error) {
type NoMethod GetMembershipGraphResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1AndroidAttributes: Resource
// representing the Android specific attributes of a Device.
type GoogleAppsCloudidentityDevicesV1AndroidAttributes struct {
// EnabledUnknownSources: Whether applications from unknown sources can
// be installed on device.
EnabledUnknownSources bool `json:"enabledUnknownSources,omitempty"`
// OwnerProfileAccount: Whether this account is on an owner/primary
// profile. For phones, only true for owner profiles. Android 4+ devices
// can have secondary or restricted user profiles.
OwnerProfileAccount bool `json:"ownerProfileAccount,omitempty"`
// OwnershipPrivilege: Ownership privileges on device.
//
// Possible values:
// "OWNERSHIP_PRIVILEGE_UNSPECIFIED" - Ownership privilege is not set.
// "DEVICE_ADMINISTRATOR" - Active device administrator privileges on
// the device.
// "PROFILE_OWNER" - Profile Owner privileges. The account is in a
// managed corporate profile.
// "DEVICE_OWNER" - Device Owner privileges on the device.
OwnershipPrivilege string `json:"ownershipPrivilege,omitempty"`
// SupportsWorkProfile: Whether device supports Android work profiles.
// If false, this service will not block access to corp data even if an
// administrator turns on the "Enforce Work Profile" policy.
SupportsWorkProfile bool `json:"supportsWorkProfile,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "EnabledUnknownSources") to unconditionally include in API requests.
// By default, fields with empty or default values are omitted from API
// requests. However, any non-pointer, non-interface field appearing in
// ForceSendFields will be sent to the server regardless of whether the
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "EnabledUnknownSources") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1AndroidAttributes) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1AndroidAttributes
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ApproveDeviceUserMetadata: Metadata
// for ApproveDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1ApproveDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest: Request
// message for approving the device to access user data.
type GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ApproveDeviceUserResponse: Response
// message for approving the device to access user data.
type GoogleAppsCloudidentityDevicesV1ApproveDeviceUserResponse struct {
// DeviceUser: Resultant DeviceUser object for the action.
DeviceUser *GoogleAppsCloudidentityDevicesV1DeviceUser `json:"deviceUser,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceUser") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceUser") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ApproveDeviceUserResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ApproveDeviceUserResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1BlockDeviceUserMetadata: Metadata for
// BlockDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1BlockDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest: Request
// message for blocking account on device.
type GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1BlockDeviceUserResponse: Response
// message for blocking the device from accessing user data.
type GoogleAppsCloudidentityDevicesV1BlockDeviceUserResponse struct {
// DeviceUser: Resultant DeviceUser object for the action.
DeviceUser *GoogleAppsCloudidentityDevicesV1DeviceUser `json:"deviceUser,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceUser") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceUser") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1BlockDeviceUserResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1BlockDeviceUserResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceMetadata: Metadata
// for CancelWipeDevice LRO.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest: Request
// message for cancelling an unfinished device wipe.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceResponse: Response
// message for cancelling an unfinished device wipe.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceResponse struct {
// Device: Resultant Device object for the action. Note that asset tags
// will not be returned in the device object.
Device *GoogleAppsCloudidentityDevicesV1Device `json:"device,omitempty"`
// ForceSendFields is a list of field names (e.g. "Device") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Device") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1CancelWipeDeviceResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserMetadata:
// Metadata for CancelWipeDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest: Request
// message for cancelling an unfinished user account wipe.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserResponse:
// Response message for cancelling an unfinished user account wipe.
type GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserResponse struct {
// DeviceUser: Resultant DeviceUser object for the action.
DeviceUser *GoogleAppsCloudidentityDevicesV1DeviceUser `json:"deviceUser,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceUser") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceUser") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ClientState: Represents the state
// associated with an API client calling the Devices API. Resource
// representing ClientState and supports updates from API users
type GoogleAppsCloudidentityDevicesV1ClientState struct {
// AssetTags: The caller can specify asset tags for this resource
AssetTags []string `json:"assetTags,omitempty"`
// ComplianceState: The compliance state of the resource as specified by
// the API client.
//
// Possible values:
// "COMPLIANCE_STATE_UNSPECIFIED" - The compliance state of the
// resource is unknown or unspecified.
// "COMPLIANT" - Device is compliant with third party policies
// "NON_COMPLIANT" - Device is not compliant with third party policies
ComplianceState string `json:"complianceState,omitempty"`
// CreateTime: Output only. The time the client state data was created.
CreateTime string `json:"createTime,omitempty"`
// CustomId: This field may be used to store a unique identifier for the
// API resource within which these CustomAttributes are a field.
CustomId string `json:"customId,omitempty"`
// Etag: The token that needs to be passed back for concurrency control
// in updates. Token needs to be passed back in UpdateRequest
Etag string `json:"etag,omitempty"`
// HealthScore: The Health score of the resource. The Health score is
// the callers specification of the condition of the device from a
// usability point of view. For example, a third-party device management
// provider may specify a health score based on its compliance with
// organizational policies.
//
// Possible values:
// "HEALTH_SCORE_UNSPECIFIED" - Default value
// "VERY_POOR" - The object is in very poor health as defined by the
// caller.
// "POOR" - The object is in poor health as defined by the caller.
// "NEUTRAL" - The object health is neither good nor poor, as defined
// by the caller.
// "GOOD" - The object is in good health as defined by the caller.
// "VERY_GOOD" - The object is in very good health as defined by the
// caller.
HealthScore string `json:"healthScore,omitempty"`
// KeyValuePairs: The map of key-value attributes stored by callers
// specific to a device. The total serialized length of this map may not
// exceed 10KB. No limit is placed on the number of attributes in a map.
KeyValuePairs map[string]GoogleAppsCloudidentityDevicesV1CustomAttributeValue `json:"keyValuePairs,omitempty"`
// LastUpdateTime: Output only. The time the client state data was last
// updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Managed: The management state of the resource as specified by the API
// client.
//
// Possible values:
// "MANAGED_STATE_UNSPECIFIED" - The management state of the resource
// is unknown or unspecified.
// "MANAGED" - The resource is managed.
// "UNMANAGED" - The resource is not managed.
Managed string `json:"managed,omitempty"`
// Name: Output only. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// ClientState in format:
// `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`,
// where partner corresponds to the partner storing the data. For
// partners belonging to the "BeyondCorp Alliance", this is the partner
// ID specified to you by Google. For all other callers, this is a
// string of the form: `{customer}-suffix`, where `customer` is your
// customer ID. The *suffix* is any string the caller specifies. This
// string will be displayed verbatim in the administration console. This
// suffix is used in setting up Custom Access Levels in Context-Aware
// Access. Your organization's customer ID can be obtained from the URL:
// `GET
// https://www.googleapis.com/admin/directory/v1/customers/my_customer`
// The `id` field in the response contains the customer ID starting with
// the letter 'C'. The customer ID to be used in this API is the string
// after the letter 'C' (not including 'C')
Name string `json:"name,omitempty"`
// OwnerType: Output only. The owner of the ClientState
//
// Possible values:
// "OWNER_TYPE_UNSPECIFIED" - Unknown owner type
// "OWNER_TYPE_CUSTOMER" - Customer is the owner
// "OWNER_TYPE_PARTNER" - Partner is the owner
OwnerType string `json:"ownerType,omitempty"`
// ScoreReason: A descriptive cause of the health score.
ScoreReason string `json:"scoreReason,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "AssetTags") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AssetTags") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ClientState) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ClientState
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1CreateDeviceMetadata: Metadata for
// CreateDevice LRO.
type GoogleAppsCloudidentityDevicesV1CreateDeviceMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1CustomAttributeValue: Additional
// custom attribute values may be one of these types
type GoogleAppsCloudidentityDevicesV1CustomAttributeValue struct {
// BoolValue: Represents a boolean value.
BoolValue bool `json:"boolValue,omitempty"`
// NumberValue: Represents a double value.
NumberValue float64 `json:"numberValue,omitempty"`
// StringValue: Represents a string value.
StringValue string `json:"stringValue,omitempty"`
// ForceSendFields is a list of field names (e.g. "BoolValue") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BoolValue") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1CustomAttributeValue) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1CustomAttributeValue
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *GoogleAppsCloudidentityDevicesV1CustomAttributeValue) UnmarshalJSON(data []byte) error {
type NoMethod GoogleAppsCloudidentityDevicesV1CustomAttributeValue
var s1 struct {
NumberValue gensupport.JSONFloat64 `json:"numberValue"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.NumberValue = float64(s1.NumberValue)
return nil
}
// GoogleAppsCloudidentityDevicesV1DeleteDeviceMetadata: Metadata for
// DeleteDevice LRO.
type GoogleAppsCloudidentityDevicesV1DeleteDeviceMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1DeleteDeviceUserMetadata: Metadata
// for DeleteDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1DeleteDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1Device: A Device within the Cloud
// Identity Devices API. Represents a Device known to Google Cloud,
// independent of the device ownership, type, and whether it is assigned
// or in use by a user.
type GoogleAppsCloudidentityDevicesV1Device struct {
// AndroidSpecificAttributes: Output only. Attributes specific to
// Android devices.
AndroidSpecificAttributes *GoogleAppsCloudidentityDevicesV1AndroidAttributes `json:"androidSpecificAttributes,omitempty"`
// AssetTag: Asset tag of the device.
AssetTag string `json:"assetTag,omitempty"`
// BasebandVersion: Output only. Baseband version of the device.
BasebandVersion string `json:"basebandVersion,omitempty"`
// BootloaderVersion: Output only. Device bootloader version. Example:
// 0.6.7.
BootloaderVersion string `json:"bootloaderVersion,omitempty"`
// Brand: Output only. Device brand. Example: Samsung.
Brand string `json:"brand,omitempty"`
// BuildNumber: Output only. Build number of the device.
BuildNumber string `json:"buildNumber,omitempty"`
// CompromisedState: Output only. Represents whether the Device is
// compromised.
//
// Possible values:
// "COMPROMISED_STATE_UNSPECIFIED" - Default value.
// "COMPROMISED" - The device is compromised (currently, this means
// Android device is rooted).
// "UNCOMPROMISED" - The device is safe (currently, this means Android
// device is unrooted).
CompromisedState string `json:"compromisedState,omitempty"`
// CreateTime: Output only. When the Company-Owned device was imported.
// This field is empty for BYOD devices.
CreateTime string `json:"createTime,omitempty"`
// DeviceId: Unique identifier for the device.
DeviceId string `json:"deviceId,omitempty"`
// DeviceType: Output only. Type of device.
//
// Possible values:
// "DEVICE_TYPE_UNSPECIFIED" - Unknown device type
// "ANDROID" - Device is an Android device
// "IOS" - Device is an iOS device
// "GOOGLE_SYNC" - Device is a Google Sync device.
// "WINDOWS" - Device is a Windows device.
// "MAC_OS" - Device is a MacOS device.
// "LINUX" - Device is a Linux device.
// "CHROME_OS" - Device is a ChromeOS device.
DeviceType string `json:"deviceType,omitempty"`
// EnabledDeveloperOptions: Output only. Whether developer options is
// enabled on device.
EnabledDeveloperOptions bool `json:"enabledDeveloperOptions,omitempty"`
// EnabledUsbDebugging: Output only. Whether USB debugging is enabled on
// device.
EnabledUsbDebugging bool `json:"enabledUsbDebugging,omitempty"`
// EncryptionState: Output only. Device encryption state.
//
// Possible values:
// "ENCRYPTION_STATE_UNSPECIFIED" - Encryption Status is not set.
// "UNSUPPORTED_BY_DEVICE" - Device doesn't support encryption.
// "ENCRYPTED" - Device is encrypted.
// "NOT_ENCRYPTED" - Device is not encrypted.
EncryptionState string `json:"encryptionState,omitempty"`
// Imei: Output only. IMEI number of device if GSM device; empty
// otherwise.
Imei string `json:"imei,omitempty"`
// KernelVersion: Output only. Kernel version of the device.
KernelVersion string `json:"kernelVersion,omitempty"`
// LastSyncTime: Most recent time when device synced with this service.
LastSyncTime string `json:"lastSyncTime,omitempty"`
// ManagementState: Output only. Management state of the device
//
// Possible values:
// "MANAGEMENT_STATE_UNSPECIFIED" - Default value. This value is
// unused.
// "APPROVED" - Device is approved.
// "BLOCKED" - Device is blocked.
// "PENDING" - Device is pending approval.
// "UNPROVISIONED" - The device is not provisioned. Device will start
// from this state until some action is taken (i.e. a user starts using
// the device).
// "WIPING" - Data and settings on the device are being removed.
// "WIPED" - All data and settings on the device are removed.
ManagementState string `json:"managementState,omitempty"`
// Manufacturer: Output only. Device manufacturer. Example: Motorola.
Manufacturer string `json:"manufacturer,omitempty"`
// Meid: Output only. MEID number of device if CDMA device; empty
// otherwise.
Meid string `json:"meid,omitempty"`
// Model: Output only. Model name of device. Example: Pixel 3.
Model string `json:"model,omitempty"`
// Name: Output only. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}`, where device is the unique id assigned
// to the Device.
Name string `json:"name,omitempty"`
// NetworkOperator: Output only. Mobile or network operator of device,
// if available.
NetworkOperator string `json:"networkOperator,omitempty"`
// OsVersion: Output only. OS version of the device. Example: Android
// 8.1.0.
OsVersion string `json:"osVersion,omitempty"`
// OtherAccounts: Output only. Domain name for Google accounts on
// device. Type for other accounts on device. On Android, will only be
// populated if |ownership_privilege| is |PROFILE_OWNER| or
// |DEVICE_OWNER|. Does not include the account signed in to the device
// policy app if that account's domain has only one account. Examples:
// "com.example", "xyz.com".
OtherAccounts []string `json:"otherAccounts,omitempty"`
// OwnerType: Output only. Whether the device is owned by the company or
// an individual
//
// Possible values:
// "DEVICE_OWNERSHIP_UNSPECIFIED" - Default value. The value is
// unused.
// "COMPANY" - Company owns the device.
// "BYOD" - Bring Your Own Device (i.e. individual owns the device)
OwnerType string `json:"ownerType,omitempty"`
// ReleaseVersion: Output only. OS release version. Example: 6.0.
ReleaseVersion string `json:"releaseVersion,omitempty"`
// SecurityPatchTime: Output only. OS security patch update time on
// device.
SecurityPatchTime string `json:"securityPatchTime,omitempty"`
// SerialNumber: Serial Number of device. Example: HT82V1A01076.
SerialNumber string `json:"serialNumber,omitempty"`
// WifiMacAddresses: WiFi MAC addresses of device.
WifiMacAddresses []string `json:"wifiMacAddresses,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g.
// "AndroidSpecificAttributes") to unconditionally include in API
// requests. By default, fields with empty or default values are omitted
// from API requests. However, any non-pointer, non-interface field
// appearing in ForceSendFields will be sent to the server regardless of
// whether the field is empty or not. This may be used to include empty
// fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g.
// "AndroidSpecificAttributes") to include in API requests with the JSON
// null value. By default, fields with empty values are omitted from API
// requests. However, any field with an empty value appearing in
// NullFields will be sent to the server as null. It is an error if a
// field in this list has a non-empty value. This may be used to include
// null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1Device) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1Device
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1DeviceUser: Represents a user's use
// of a Device in the Cloud Identity Devices API. A DeviceUser is a
// resource representing a user's use of a Device
type GoogleAppsCloudidentityDevicesV1DeviceUser struct {
// CompromisedState: Compromised State of the DeviceUser object
//
// Possible values:
// "COMPROMISED_STATE_UNSPECIFIED" - Compromised state of Device User
// account is unknown or unspecified.
// "COMPROMISED" - Device User Account is compromised.
// "NOT_COMPROMISED" - Device User Account is not compromised.
CompromisedState string `json:"compromisedState,omitempty"`
// CreateTime: When the user first signed in to the device
CreateTime string `json:"createTime,omitempty"`
// FirstSyncTime: Output only. Most recent time when user registered
// with this service.
FirstSyncTime string `json:"firstSyncTime,omitempty"`
// LanguageCode: Output only. Default locale used on device, in IETF
// BCP-47 format.
LanguageCode string `json:"languageCode,omitempty"`
// LastSyncTime: Output only. Last time when user synced with policies.
LastSyncTime string `json:"lastSyncTime,omitempty"`
// ManagementState: Output only. Management state of the user on the
// device.
//
// Possible values:
// "MANAGEMENT_STATE_UNSPECIFIED" - Default value. This value is
// unused.
// "WIPING" - This user's data and profile is being removed from the
// device.
// "WIPED" - This user's data and profile is removed from the device.
// "APPROVED" - User is approved to access data on the device.
// "BLOCKED" - User is blocked from accessing data on the device.
// "PENDING_APPROVAL" - User is awaiting approval.
// "UNENROLLED" - User is unenrolled from Advanced Windows Management,
// but the Windows account is still intact.
ManagementState string `json:"managementState,omitempty"`
// Name: Output only. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// DeviceUser in format: `devices/{device}/deviceUsers/{device_user}`,
// where `device_user` uniquely identifies a user's use of a device.
Name string `json:"name,omitempty"`
// PasswordState: Password state of the DeviceUser object
//
// Possible values:
// "PASSWORD_STATE_UNSPECIFIED" - Password state not set.
// "PASSWORD_SET" - Password set in object.
// "PASSWORD_NOT_SET" - Password not set in object.
PasswordState string `json:"passwordState,omitempty"`
// UserAgent: Output only. User agent on the device for this specific
// user
UserAgent string `json:"userAgent,omitempty"`
// UserEmail: Email address of the user registered on the device.
UserEmail string `json:"userEmail,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CompromisedState") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CompromisedState") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1DeviceUser) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1DeviceUser
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ListClientStatesResponse: Response
// message that is returned in ListClientStates.
type GoogleAppsCloudidentityDevicesV1ListClientStatesResponse struct {
// ClientStates: Client states meeting the list restrictions.
ClientStates []*GoogleAppsCloudidentityDevicesV1ClientState `json:"clientStates,omitempty"`
// NextPageToken: Token to retrieve the next page of results. Empty if
// there are no more results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "ClientStates") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ClientStates") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ListClientStatesResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ListClientStatesResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse: Response
// message that is returned from the ListDeviceUsers method.
type GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse struct {
// DeviceUsers: Devices meeting the list restrictions.
DeviceUsers []*GoogleAppsCloudidentityDevicesV1DeviceUser `json:"deviceUsers,omitempty"`
// NextPageToken: Token to retrieve the next page of results. Empty if
// there are no more results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "DeviceUsers") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceUsers") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ListDevicesResponse: Response message
// that is returned from the ListDevices method.
type GoogleAppsCloudidentityDevicesV1ListDevicesResponse struct {
// Devices: Devices meeting the list restrictions.
Devices []*GoogleAppsCloudidentityDevicesV1Device `json:"devices,omitempty"`
// NextPageToken: Token to retrieve the next page of results. Empty if
// there are no more results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Devices") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Devices") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1ListDevicesResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1ListDevicesResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1ListEndpointAppsMetadata: Metadata
// for ListEndpointApps LRO.
type GoogleAppsCloudidentityDevicesV1ListEndpointAppsMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse:
// Response containing resource names of the DeviceUsers associated with
// the caller's credentials.
type GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse struct {
// Customer: The obfuscated customer Id that may be passed back to other
// Devices API methods such as List, Get, etc.
Customer string `json:"customer,omitempty"`
// Names: Resource names
// (https://cloud.google.com/apis/design/resource_names) of the
// DeviceUsers in the format:
// `devices/{device}/deviceUsers/{user_resource}`, where device is the
// unique ID assigned to a Device and user_resource is the unique user
// ID
Names []string `json:"names,omitempty"`
// NextPageToken: Token to retrieve the next page of results. Empty if
// there are no more results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1SignoutDeviceUserMetadata: Metadata
// for SignoutDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1SignoutDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1UpdateClientStateMetadata: Metadata
// for UpdateClientState LRO.
type GoogleAppsCloudidentityDevicesV1UpdateClientStateMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1UpdateDeviceMetadata: Metadata for
// UpdateDevice LRO.
type GoogleAppsCloudidentityDevicesV1UpdateDeviceMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceMetadata: Metadata for
// WipeDevice LRO.
type GoogleAppsCloudidentityDevicesV1WipeDeviceMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceRequest: Request message
// for wiping all data on the device.
type GoogleAppsCloudidentityDevicesV1WipeDeviceRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// RemoveResetLock: Optional. Specifies if a user is able to factory
// reset a device after a Device Wipe. On iOS, this is called
// "Activation Lock", while on Android, this is known as "Factory Reset
// Protection". If true, this protection will be removed from the
// device, so that a user can successfully factory reset. If false, the
// setting is untouched on the device.
RemoveResetLock bool `json:"removeResetLock,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1WipeDeviceRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1WipeDeviceRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceResponse: Response message
// for wiping all data on the device.
type GoogleAppsCloudidentityDevicesV1WipeDeviceResponse struct {
// Device: Resultant Device object for the action. Note that asset tags
// will not be returned in the device object.
Device *GoogleAppsCloudidentityDevicesV1Device `json:"device,omitempty"`
// ForceSendFields is a list of field names (e.g. "Device") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Device") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1WipeDeviceResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1WipeDeviceResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceUserMetadata: Metadata for
// WipeDeviceUser LRO.
type GoogleAppsCloudidentityDevicesV1WipeDeviceUserMetadata struct {
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest: Request
// message for starting an account wipe on device.
type GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest struct {
// Customer: Optional. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
Customer string `json:"customer,omitempty"`
// ForceSendFields is a list of field names (e.g. "Customer") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Customer") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GoogleAppsCloudidentityDevicesV1WipeDeviceUserResponse: Response
// message for wiping the user's account from the device.
type GoogleAppsCloudidentityDevicesV1WipeDeviceUserResponse struct {
// DeviceUser: Resultant DeviceUser object for the action.
DeviceUser *GoogleAppsCloudidentityDevicesV1DeviceUser `json:"deviceUser,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceUser") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceUser") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GoogleAppsCloudidentityDevicesV1WipeDeviceUserResponse) MarshalJSON() ([]byte, error) {
type NoMethod GoogleAppsCloudidentityDevicesV1WipeDeviceUserResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Group: A group within the Cloud Identity Groups API. A `Group` is a
// collection of entities, where each entity is either a user, another
// group, or a service account.
type Group struct {
// CreateTime: Output only. The time when the `Group` was created.
CreateTime string `json:"createTime,omitempty"`
// Description: An extended description to help users determine the
// purpose of a `Group`. Must not be longer than 4,096 characters.
Description string `json:"description,omitempty"`
// DisplayName: The display name of the `Group`.
DisplayName string `json:"displayName,omitempty"`
// DynamicGroupMetadata: Optional. Dynamic group metadata like queries
// and status.
DynamicGroupMetadata *DynamicGroupMetadata `json:"dynamicGroupMetadata,omitempty"`
// GroupKey: Required. The `EntityKey` of the `Group`.
GroupKey *EntityKey `json:"groupKey,omitempty"`
// Labels: Required. One or more label entries that apply to the Group.
// Currently supported labels contain a key with an empty value. Google
// Groups are the default type of group and have a label with a key of
// `cloudidentity.googleapis.com/groups.discussion_forum` and an empty
// value. Existing Google Groups can have an additional label with a key
// of `cloudidentity.googleapis.com/groups.security` and an empty value
// added to them. **This is an immutable change and the security label
// cannot be removed once added.** Dynamic groups have a label with a
// key of `cloudidentity.googleapis.com/groups.dynamic`. Identity-mapped
// groups for Cloud Search have a label with a key of
// `system/groups/external` and an empty value.
Labels map[string]string `json:"labels,omitempty"`
// Name: Output only. The resource name
// (https://cloud.google.com/apis/design/resource_names) of the `Group`.
// Shall be of the form `groups/{group}`.
Name string `json:"name,omitempty"`
// Parent: Required. Immutable. The resource name of the entity under
// which this `Group` resides in the Cloud Identity resource hierarchy.
// Must be of the form `identitysources/{identity_source}` for external-
// identity-mapped groups or `customers/{customer}` for Google Groups.
// The `customer` must begin with "C" (for example, 'C046psxkn').
Parent string `json:"parent,omitempty"`
// UpdateTime: Output only. The time when the `Group` was last updated.
UpdateTime string `json:"updateTime,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CreateTime") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CreateTime") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Group) MarshalJSON() ([]byte, error) {
type NoMethod Group
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// GroupRelation: Message representing a transitive group of a user or a
// group.
type GroupRelation struct {
// DisplayName: Display name for this group.
DisplayName string `json:"displayName,omitempty"`
// Group: Resource name for this group.
Group string `json:"group,omitempty"`
// GroupKey: Entity key has an id and a namespace. In case of discussion
// forums, the id will be an email address without a namespace.
GroupKey *EntityKey `json:"groupKey,omitempty"`
// Labels: Labels for Group resource.
Labels map[string]string `json:"labels,omitempty"`
// RelationType: The relation between the member and the transitive
// group.
//
// Possible values:
// "RELATION_TYPE_UNSPECIFIED" - The relation type is undefined or
// undetermined.
// "DIRECT" - The two entities have only a direct membership with each
// other.
// "INDIRECT" - The two entities have only an indirect membership with
// each other.
// "DIRECT_AND_INDIRECT" - The two entities have both a direct and an
// indirect membership with each other.
RelationType string `json:"relationType,omitempty"`
// Roles: Membership roles of the member for the group.
Roles []*TransitiveMembershipRole `json:"roles,omitempty"`
// ForceSendFields is a list of field names (e.g. "DisplayName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DisplayName") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *GroupRelation) MarshalJSON() ([]byte, error) {
type NoMethod GroupRelation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// IsInvitableUserResponse: Response for IsInvitableUser RPC.
type IsInvitableUserResponse struct {
// IsInvitableUser: Returns true if the email address is invitable.
IsInvitableUser bool `json:"isInvitableUser,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "IsInvitableUser") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "IsInvitableUser") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *IsInvitableUserResponse) MarshalJSON() ([]byte, error) {
type NoMethod IsInvitableUserResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListGroupsResponse: Response message for ListGroups operation.
type ListGroupsResponse struct {
// Groups: Groups returned in response to list request. The results are
// not sorted.
Groups []*Group `json:"groups,omitempty"`
// NextPageToken: Token to retrieve the next page of results, or empty
// if there are no more results available for listing.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Groups") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Groups") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListGroupsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListGroupsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListMembershipsResponse: The response message for
// MembershipsService.ListMemberships.
type ListMembershipsResponse struct {
// Memberships: The `Membership`s under the specified `parent`.
Memberships []*Membership `json:"memberships,omitempty"`
// NextPageToken: A continuation token to retrieve the next page of
// results, or empty if there are no more results available.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Memberships") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Memberships") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListMembershipsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListMembershipsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListUserInvitationsResponse: Response message for UserInvitation
// listing request.
type ListUserInvitationsResponse struct {
// NextPageToken: The token for the next page. If not empty, indicates
// that there may be more `UserInvitation` resources that match the
// listing request; this value can be used in a subsequent
// ListUserInvitationsRequest to get continued results with the current
// list call.
NextPageToken string `json:"nextPageToken,omitempty"`
// UserInvitations: The list of UserInvitation resources.
UserInvitations []*UserInvitation `json:"userInvitations,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "NextPageToken") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "NextPageToken") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListUserInvitationsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListUserInvitationsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// LookupGroupNameResponse: The response message for
// GroupsService.LookupGroupName.
type LookupGroupNameResponse struct {
// Name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// looked-up `Group`.
Name string `json:"name,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Name") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Name") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LookupGroupNameResponse) MarshalJSON() ([]byte, error) {
type NoMethod LookupGroupNameResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// LookupMembershipNameResponse: The response message for
// MembershipsService.LookupMembershipName.
type LookupMembershipNameResponse struct {
// Name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// looked-up `Membership`. Must be of the form
// `groups/{group}/memberships/{membership}`.
Name string `json:"name,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Name") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Name") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *LookupMembershipNameResponse) MarshalJSON() ([]byte, error) {
type NoMethod LookupMembershipNameResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MemberRelation: Message representing a transitive membership of a
// group.
type MemberRelation struct {
// Member: Resource name for this member.
Member string `json:"member,omitempty"`
// PreferredMemberKey: Entity key has an id and a namespace. In case of
// discussion forums, the id will be an email address without a
// namespace.
PreferredMemberKey []*EntityKey `json:"preferredMemberKey,omitempty"`
// RelationType: The relation between the group and the transitive
// member.
//
// Possible values:
// "RELATION_TYPE_UNSPECIFIED" - The relation type is undefined or
// undetermined.
// "DIRECT" - The two entities have only a direct membership with each
// other.
// "INDIRECT" - The two entities have only an indirect membership with
// each other.
// "DIRECT_AND_INDIRECT" - The two entities have both a direct and an
// indirect membership with each other.
RelationType string `json:"relationType,omitempty"`
// Roles: The membership role details (i.e name of role and expiry
// time).
Roles []*TransitiveMembershipRole `json:"roles,omitempty"`
// ForceSendFields is a list of field names (e.g. "Member") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Member") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *MemberRelation) MarshalJSON() ([]byte, error) {
type NoMethod MemberRelation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MemberRestriction: The definition of MemberRestriction
type MemberRestriction struct {
// Evaluation: The evaluated state of this restriction on a group.
Evaluation *RestrictionEvaluation `json:"evaluation,omitempty"`
// Query: Member Restriction as defined by CEL expression. Supported
// restrictions are: `member.customer_id` and `member.type`. Valid
// values for `member.type` are `1`, `2` and `3`. They correspond to
// USER, SERVICE_ACCOUNT, and GROUP respectively. The value for
// `member.customer_id` only supports `groupCustomerId()` currently
// which means the customer id of the group will be used for
// restriction. Supported operators are `&&`, `||` and `==`,
// corresponding to AND, OR, and EQUAL. Examples: Allow only service
// accounts of given customer to be members. `member.type == 2 &&
// member.customer_id == groupCustomerId()` Allow only users or groups
// to be members. `member.type == 1 || member.type == 3`
Query string `json:"query,omitempty"`
// ForceSendFields is a list of field names (e.g. "Evaluation") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Evaluation") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *MemberRestriction) MarshalJSON() ([]byte, error) {
type NoMethod MemberRestriction
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Membership: A membership within the Cloud Identity Groups API. A
// `Membership` defines a relationship between a `Group` and an entity
// belonging to that `Group`, referred to as a "member".
type Membership struct {
// CreateTime: Output only. The time when the `Membership` was created.
CreateTime string `json:"createTime,omitempty"`
// Name: Output only. The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Membership`. Shall be of the form
// `groups/{group}/memberships/{membership}`.
Name string `json:"name,omitempty"`
// PreferredMemberKey: Required. Immutable. The `EntityKey` of the
// member.
PreferredMemberKey *EntityKey `json:"preferredMemberKey,omitempty"`
// Roles: The `MembershipRole`s that apply to the `Membership`. If
// unspecified, defaults to a single `MembershipRole` with `name`
// `MEMBER`. Must not contain duplicate `MembershipRole`s with the same
// `name`.
Roles []*MembershipRole `json:"roles,omitempty"`
// Type: Output only. The type of the membership.
//
// Possible values:
// "TYPE_UNSPECIFIED" - Default. Should not be used.
// "USER" - Represents user type.
// "SERVICE_ACCOUNT" - Represents service account type.
// "GROUP" - Represents group type.
// "SHARED_DRIVE" - Represents Shared drive.
// "OTHER" - Represents other type.
Type string `json:"type,omitempty"`
// UpdateTime: Output only. The time when the `Membership` was last
// updated.
UpdateTime string `json:"updateTime,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CreateTime") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CreateTime") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Membership) MarshalJSON() ([]byte, error) {
type NoMethod Membership
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MembershipAdjacencyList: Membership graph's path information as an
// adjacency list.
type MembershipAdjacencyList struct {
// Edges: Each edge contains information about the member that belongs
// to this group. Note: Fields returned here will help identify the
// specific Membership resource (e.g name, preferred_member_key and
// role), but may not be a comprehensive list of all fields.
Edges []*Membership `json:"edges,omitempty"`
// Group: Resource name of the group that the members belong to.
Group string `json:"group,omitempty"`
// ForceSendFields is a list of field names (e.g. "Edges") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Edges") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *MembershipAdjacencyList) MarshalJSON() ([]byte, error) {
type NoMethod MembershipAdjacencyList
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MembershipRole: A membership role within the Cloud Identity Groups
// API. A `MembershipRole` defines the privileges granted to a
// `Membership`.
type MembershipRole struct {
// ExpiryDetail: The expiry details of the `MembershipRole`. Expiry
// details are only supported for `MEMBER` `MembershipRoles`. May be set
// if `name` is `MEMBER`. Must not be set if `name` is any other value.
ExpiryDetail *ExpiryDetail `json:"expiryDetail,omitempty"`
// Name: The name of the `MembershipRole`. Must be one of `OWNER`,
// `MANAGER`, `MEMBER`.
Name string `json:"name,omitempty"`
// RestrictionEvaluations: Evaluations of restrictions applied to parent
// group on this membership.
RestrictionEvaluations *RestrictionEvaluations `json:"restrictionEvaluations,omitempty"`
// ForceSendFields is a list of field names (e.g. "ExpiryDetail") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ExpiryDetail") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *MembershipRole) MarshalJSON() ([]byte, error) {
type NoMethod MembershipRole
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MembershipRoleRestrictionEvaluation: The evaluated state of this
// restriction.
type MembershipRoleRestrictionEvaluation struct {
// State: Output only. The current state of the restriction
//
// Possible values:
// "STATE_UNSPECIFIED" - Default. Should not be used.
// "COMPLIANT" - The member adheres to the parent group's restriction.
// "FORWARD_COMPLIANT" - The group-group membership might be currently
// violating some parent group's restriction but in future, it will
// never allow any new member in the child group which can violate
// parent group's restriction.
// "NON_COMPLIANT" - The member violates the parent group's
// restriction.
// "EVALUATING" - The state of the membership is under evaluation.
State string `json:"state,omitempty"`
// ForceSendFields is a list of field names (e.g. "State") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "State") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *MembershipRoleRestrictionEvaluation) MarshalJSON() ([]byte, error) {
type NoMethod MembershipRoleRestrictionEvaluation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ModifyMembershipRolesRequest: The request message for
// MembershipsService.ModifyMembershipRoles.
type ModifyMembershipRolesRequest struct {
// AddRoles: The `MembershipRole`s to be added. Adding or removing roles
// in the same request as updating roles is not supported. Must not be
// set if `update_roles_params` is set.
AddRoles []*MembershipRole `json:"addRoles,omitempty"`
// RemoveRoles: The `name`s of the `MembershipRole`s to be removed.
// Adding or removing roles in the same request as updating roles is not
// supported. It is not possible to remove the `MEMBER`
// `MembershipRole`. If you wish to delete a `Membership`, call
// MembershipsService.DeleteMembership instead. Must not contain
// `MEMBER`. Must not be set if `update_roles_params` is set.
RemoveRoles []string `json:"removeRoles,omitempty"`
// UpdateRolesParams: The `MembershipRole`s to be updated. Updating
// roles in the same request as adding or removing roles is not
// supported. Must not be set if either `add_roles` or `remove_roles` is
// set.
UpdateRolesParams []*UpdateMembershipRolesParams `json:"updateRolesParams,omitempty"`
// ForceSendFields is a list of field names (e.g. "AddRoles") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AddRoles") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ModifyMembershipRolesRequest) MarshalJSON() ([]byte, error) {
type NoMethod ModifyMembershipRolesRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ModifyMembershipRolesResponse: The response message for
// MembershipsService.ModifyMembershipRoles.
type ModifyMembershipRolesResponse struct {
// Membership: The `Membership` resource after modifying its
// `MembershipRole`s.
Membership *Membership `json:"membership,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Membership") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Membership") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ModifyMembershipRolesResponse) MarshalJSON() ([]byte, error) {
type NoMethod ModifyMembershipRolesResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Operation: This resource represents a long-running operation that is
// the result of a network API call.
type Operation struct {
// Done: If the value is `false`, it means the operation is still in
// progress. If `true`, the operation is completed, and either `error`
// or `response` is available.
Done bool `json:"done,omitempty"`
// Error: The error result of the operation in case of failure or
// cancellation.
Error *Status `json:"error,omitempty"`
// Metadata: Service-specific metadata associated with the operation. It
// typically contains progress information and common metadata such as
// create time. Some services might not provide such metadata. Any
// method that returns a long-running operation should document the
// metadata type, if any.
Metadata googleapi.RawMessage `json:"metadata,omitempty"`
// Name: The server-assigned name, which is only unique within the same
// service that originally returns it. If you use the default HTTP
// mapping, the `name` should be a resource name ending with
// `operations/{unique_id}`.
Name string `json:"name,omitempty"`
// Response: The normal response of the operation in case of success. If
// the original method returns no data on success, such as `Delete`, the
// response is `google.protobuf.Empty`. If the original method is
// standard `Get`/`Create`/`Update`, the response should be the
// resource. For other methods, the response should have the type
// `XxxResponse`, where `Xxx` is the original method name. For example,
// if the original method name is `TakeSnapshot()`, the inferred
// response type is `TakeSnapshotResponse`.
Response googleapi.RawMessage `json:"response,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Done") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Done") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Operation) MarshalJSON() ([]byte, error) {
type NoMethod Operation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RestrictionEvaluation: The evaluated state of this restriction.
type RestrictionEvaluation struct {
// State: Output only. The current state of the restriction
//
// Possible values:
// "STATE_UNSPECIFIED" - Default. Should not be used.
// "EVALUATING" - The restriction state is currently being evaluated.
// "COMPLIANT" - All transitive memberships are adhering to
// restriction.
// "FORWARD_COMPLIANT" - Some transitive memberships violate the
// restriction. No new violating memberships can be added.
// "NON_COMPLIANT" - Some transitive memberships violate the
// restriction. New violating direct memberships will be denied while
// indirect memberships may be added.
State string `json:"state,omitempty"`
// ForceSendFields is a list of field names (e.g. "State") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "State") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *RestrictionEvaluation) MarshalJSON() ([]byte, error) {
type NoMethod RestrictionEvaluation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RestrictionEvaluations: Evaluations of restrictions applied to parent
// group on this membership.
type RestrictionEvaluations struct {
// MemberRestrictionEvaluation: Evaluation of the member restriction
// applied to this membership. Empty if the user lacks permission to
// view the restriction evaluation.
MemberRestrictionEvaluation *MembershipRoleRestrictionEvaluation `json:"memberRestrictionEvaluation,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "MemberRestrictionEvaluation") to unconditionally include in API
// requests. By default, fields with empty or default values are omitted
// from API requests. However, any non-pointer, non-interface field
// appearing in ForceSendFields will be sent to the server regardless of
// whether the field is empty or not. This may be used to include empty
// fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g.
// "MemberRestrictionEvaluation") to include in API requests with the
// JSON null value. By default, fields with empty values are omitted
// from API requests. However, any field with an empty value appearing
// in NullFields will be sent to the server as null. It is an error if a
// field in this list has a non-empty value. This may be used to include
// null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *RestrictionEvaluations) MarshalJSON() ([]byte, error) {
type NoMethod RestrictionEvaluations
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SearchGroupsResponse: The response message for
// GroupsService.SearchGroups.
type SearchGroupsResponse struct {
// Groups: The `Group` resources that match the search query.
Groups []*Group `json:"groups,omitempty"`
// NextPageToken: A continuation token to retrieve the next page of
// results, or empty if there are no more results available.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Groups") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Groups") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SearchGroupsResponse) MarshalJSON() ([]byte, error) {
type NoMethod SearchGroupsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SearchTransitiveGroupsResponse: The response message for
// MembershipsService.SearchTransitiveGroups.
type SearchTransitiveGroupsResponse struct {
// Memberships: List of transitive groups satisfying the query.
Memberships []*GroupRelation `json:"memberships,omitempty"`
// NextPageToken: Token to retrieve the next page of results, or empty
// if there are no more results available for listing.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Memberships") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Memberships") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SearchTransitiveGroupsResponse) MarshalJSON() ([]byte, error) {
type NoMethod SearchTransitiveGroupsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SearchTransitiveMembershipsResponse: The response message for
// MembershipsService.SearchTransitiveMemberships.
type SearchTransitiveMembershipsResponse struct {
// Memberships: List of transitive members satisfying the query.
Memberships []*MemberRelation `json:"memberships,omitempty"`
// NextPageToken: Token to retrieve the next page of results, or empty
// if there are no more results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Memberships") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Memberships") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SearchTransitiveMembershipsResponse) MarshalJSON() ([]byte, error) {
type NoMethod SearchTransitiveMembershipsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SecuritySettings: The definition of security settings.
type SecuritySettings struct {
// MemberRestriction: The Member Restriction value
MemberRestriction *MemberRestriction `json:"memberRestriction,omitempty"`
// Name: Output only. The resource name of the security settings. Shall
// be of the form `groups/{group_id}/securitySettings`.
Name string `json:"name,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "MemberRestriction")
// to unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "MemberRestriction") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *SecuritySettings) MarshalJSON() ([]byte, error) {
type NoMethod SecuritySettings
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SendUserInvitationRequest: A request to send email for inviting
// target user corresponding to the UserInvitation.
type SendUserInvitationRequest struct {
}
// Status: The `Status` type defines a logical error model that is
// suitable for different programming environments, including REST APIs
// and RPC APIs. It is used by gRPC (https://github.com/grpc). Each
// `Status` message contains three pieces of data: error code, error
// message, and error details. You can find out more about this error
// model and how to work with it in the API Design Guide
// (https://cloud.google.com/apis/design/errors).
type Status struct {
// Code: The status code, which should be an enum value of
// google.rpc.Code.
Code int64 `json:"code,omitempty"`
// Details: A list of messages that carry the error details. There is a
// common set of message types for APIs to use.
Details []googleapi.RawMessage `json:"details,omitempty"`
// Message: A developer-facing error message, which should be in
// English. Any user-facing error message should be localized and sent
// in the google.rpc.Status.details field, or localized by the client.
Message string `json:"message,omitempty"`
// ForceSendFields is a list of field names (e.g. "Code") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Code") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Status) MarshalJSON() ([]byte, error) {
type NoMethod Status
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// TransitiveMembershipRole: Message representing the role of a
// TransitiveMembership.
type TransitiveMembershipRole struct {
// Role: TransitiveMembershipRole in string format. Currently supported
// TransitiveMembershipRoles: "MEMBER", "OWNER", and "MANAGER".
Role string `json:"role,omitempty"`
// ForceSendFields is a list of field names (e.g. "Role") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Role") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *TransitiveMembershipRole) MarshalJSON() ([]byte, error) {
type NoMethod TransitiveMembershipRole
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// UpdateGroupMetadata: Metadata for UpdateGroup LRO.
type UpdateGroupMetadata struct {
}
// UpdateMembershipMetadata: Metadata for UpdateMembership LRO.
type UpdateMembershipMetadata struct {
}
// UpdateMembershipRolesParams: The details of an update to a
// `MembershipRole`.
type UpdateMembershipRolesParams struct {
// FieldMask: The fully-qualified names of fields to update. May only
// contain the field `expiry_detail.expire_time`.
FieldMask string `json:"fieldMask,omitempty"`
// MembershipRole: The `MembershipRole`s to be updated. Only `MEMBER`
// `MembershipRole` can currently be updated.
MembershipRole *MembershipRole `json:"membershipRole,omitempty"`
// ForceSendFields is a list of field names (e.g. "FieldMask") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "FieldMask") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *UpdateMembershipRolesParams) MarshalJSON() ([]byte, error) {
type NoMethod UpdateMembershipRolesParams
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// UserInvitation: The `UserInvitation` resource represents an email
// that can be sent to an unmanaged user account inviting them to join
// the customer's Google Workspace or Cloud Identity account. An
// unmanaged account shares an email address domain with the Google
// Workspace or Cloud Identity account but is not managed by it yet. If
// the user accepts the `UserInvitation`, the user account will become
// managed.
type UserInvitation struct {
// MailsSentCount: Number of invitation emails sent to the user.
MailsSentCount int64 `json:"mailsSentCount,omitempty,string"`
// Name: Shall be of the form
// `customers/{customer}/userinvitations/{user_email_address}`.
Name string `json:"name,omitempty"`
// State: State of the `UserInvitation`.
//
// Possible values:
// "STATE_UNSPECIFIED" - The default value. This value is used if the
// state is omitted.
// "NOT_YET_SENT" - The `UserInvitation` has been created and is ready
// for sending as an email.
// "INVITED" - The user has been invited by email.
// "ACCEPTED" - The user has accepted the invitation and is part of
// the organization.
// "DECLINED" - The user declined the invitation.
State string `json:"state,omitempty"`
// UpdateTime: Time when the `UserInvitation` was last updated.
UpdateTime string `json:"updateTime,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "MailsSentCount") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "MailsSentCount") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *UserInvitation) MarshalJSON() ([]byte, error) {
type NoMethod UserInvitation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "cloudidentity.customers.userinvitations.cancel":
type CustomersUserinvitationsCancelCall struct {
s *Service
name string
canceluserinvitationrequest *CancelUserInvitationRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Cancel: Cancels a UserInvitation that was already sent.
//
// - name: `UserInvitation` name in the format
// `customers/{customer}/userinvitations/{user_email_address}`.
func (r *CustomersUserinvitationsService) Cancel(name string, canceluserinvitationrequest *CancelUserInvitationRequest) *CustomersUserinvitationsCancelCall {
c := &CustomersUserinvitationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.canceluserinvitationrequest = canceluserinvitationrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CustomersUserinvitationsCancelCall) Fields(s ...googleapi.Field) *CustomersUserinvitationsCancelCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CustomersUserinvitationsCancelCall) Context(ctx context.Context) *CustomersUserinvitationsCancelCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CustomersUserinvitationsCancelCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CustomersUserinvitationsCancelCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceluserinvitationrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.customers.userinvitations.cancel" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *CustomersUserinvitationsCancelCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Cancels a UserInvitation that was already sent.",
// "flatPath": "v1/customers/{customersId}/userinvitations/{userinvitationsId}:cancel",
// "httpMethod": "POST",
// "id": "cloudidentity.customers.userinvitations.cancel",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`",
// "location": "path",
// "pattern": "^customers/[^/]+/userinvitations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:cancel",
// "request": {
// "$ref": "CancelUserInvitationRequest"
// },
// "response": {
// "$ref": "Operation"
// }
// }
}
// method id "cloudidentity.customers.userinvitations.get":
type CustomersUserinvitationsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves a UserInvitation resource. **Note:** New consumer
// accounts with the customer's verified domain created within the
// previous 48 hours will not appear in the result. This delay also
// applies to newly-verified domains.
//
// - name: `UserInvitation` name in the format
// `customers/{customer}/userinvitations/{user_email_address}`.
func (r *CustomersUserinvitationsService) Get(name string) *CustomersUserinvitationsGetCall {
c := &CustomersUserinvitationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CustomersUserinvitationsGetCall) Fields(s ...googleapi.Field) *CustomersUserinvitationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *CustomersUserinvitationsGetCall) IfNoneMatch(entityTag string) *CustomersUserinvitationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CustomersUserinvitationsGetCall) Context(ctx context.Context) *CustomersUserinvitationsGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CustomersUserinvitationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CustomersUserinvitationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.customers.userinvitations.get" call.
// Exactly one of *UserInvitation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *UserInvitation.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *CustomersUserinvitationsGetCall) Do(opts ...googleapi.CallOption) (*UserInvitation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &UserInvitation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a UserInvitation resource. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.",
// "flatPath": "v1/customers/{customersId}/userinvitations/{userinvitationsId}",
// "httpMethod": "GET",
// "id": "cloudidentity.customers.userinvitations.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`",
// "location": "path",
// "pattern": "^customers/[^/]+/userinvitations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "UserInvitation"
// }
// }
}
// method id "cloudidentity.customers.userinvitations.isInvitableUser":
type CustomersUserinvitationsIsInvitableUserCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// IsInvitableUser: Verifies whether a user account is eligible to
// receive a UserInvitation (is an unmanaged account). Eligibility is
// based on the following criteria: * the email address is a consumer
// account and it's the primary email address of the account, and * the
// domain of the email address matches an existing verified Google
// Workspace or Cloud Identity domain If both conditions are met, the
// user is eligible. **Note:** This method is not supported for
// Workspace Essentials customers.
//
// - name: `UserInvitation` name in the format
// `customers/{customer}/userinvitations/{user_email_address}`.
func (r *CustomersUserinvitationsService) IsInvitableUser(name string) *CustomersUserinvitationsIsInvitableUserCall {
c := &CustomersUserinvitationsIsInvitableUserCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CustomersUserinvitationsIsInvitableUserCall) Fields(s ...googleapi.Field) *CustomersUserinvitationsIsInvitableUserCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *CustomersUserinvitationsIsInvitableUserCall) IfNoneMatch(entityTag string) *CustomersUserinvitationsIsInvitableUserCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CustomersUserinvitationsIsInvitableUserCall) Context(ctx context.Context) *CustomersUserinvitationsIsInvitableUserCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CustomersUserinvitationsIsInvitableUserCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CustomersUserinvitationsIsInvitableUserCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:isInvitableUser")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.customers.userinvitations.isInvitableUser" call.
// Exactly one of *IsInvitableUserResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *IsInvitableUserResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *CustomersUserinvitationsIsInvitableUserCall) Do(opts ...googleapi.CallOption) (*IsInvitableUserResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &IsInvitableUserResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Verifies whether a user account is eligible to receive a UserInvitation (is an unmanaged account). Eligibility is based on the following criteria: * the email address is a consumer account and it's the primary email address of the account, and * the domain of the email address matches an existing verified Google Workspace or Cloud Identity domain If both conditions are met, the user is eligible. **Note:** This method is not supported for Workspace Essentials customers.",
// "flatPath": "v1/customers/{customersId}/userinvitations/{userinvitationsId}:isInvitableUser",
// "httpMethod": "GET",
// "id": "cloudidentity.customers.userinvitations.isInvitableUser",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`",
// "location": "path",
// "pattern": "^customers/[^/]+/userinvitations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:isInvitableUser",
// "response": {
// "$ref": "IsInvitableUserResponse"
// }
// }
}
// method id "cloudidentity.customers.userinvitations.list":
type CustomersUserinvitationsListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Retrieves a list of UserInvitation resources. **Note:** New
// consumer accounts with the customer's verified domain created within
// the previous 48 hours will not appear in the result. This delay also
// applies to newly-verified domains.
//
// - parent: The customer ID of the Google Workspace or Cloud Identity
// account the UserInvitation resources are associated with.
func (r *CustomersUserinvitationsService) List(parent string) *CustomersUserinvitationsListCall {
c := &CustomersUserinvitationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Filter sets the optional parameter "filter": A query string for
// filtering `UserInvitation` results by their current state, in the
// format: "state=='invited'".
func (c *CustomersUserinvitationsListCall) Filter(filter string) *CustomersUserinvitationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": The sort order of the
// list results. You can sort the results in descending order based on
// either email or last update timestamp but not both, using
// `order_by="email desc". Currently, sorting is supported for
// `update_time asc`, `update_time desc`, `email asc`, and `email desc`.
// If not specified, results will be returned based on `email asc`
// order.
func (c *CustomersUserinvitationsListCall) OrderBy(orderBy string) *CustomersUserinvitationsListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of UserInvitation resources to return. If unspecified, at most 100
// resources will be returned. The maximum value is 200; values above
// 200 will be set to 200.
func (c *CustomersUserinvitationsListCall) PageSize(pageSize int64) *CustomersUserinvitationsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": A page token,
// received from a previous `ListUserInvitations` call. Provide this to
// retrieve the subsequent page. When paginating, all other parameters
// provided to `ListBooks` must match the call that provided the page
// token.
func (c *CustomersUserinvitationsListCall) PageToken(pageToken string) *CustomersUserinvitationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CustomersUserinvitationsListCall) Fields(s ...googleapi.Field) *CustomersUserinvitationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *CustomersUserinvitationsListCall) IfNoneMatch(entityTag string) *CustomersUserinvitationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CustomersUserinvitationsListCall) Context(ctx context.Context) *CustomersUserinvitationsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CustomersUserinvitationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CustomersUserinvitationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/userinvitations")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.customers.userinvitations.list" call.
// Exactly one of *ListUserInvitationsResponse or error will be non-nil.
// Any non-2xx status code is an error. Response headers are in either
// *ListUserInvitationsResponse.ServerResponse.Header or (if a response
// was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *CustomersUserinvitationsListCall) Do(opts ...googleapi.CallOption) (*ListUserInvitationsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListUserInvitationsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a list of UserInvitation resources. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.",
// "flatPath": "v1/customers/{customersId}/userinvitations",
// "httpMethod": "GET",
// "id": "cloudidentity.customers.userinvitations.list",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "filter": {
// "description": "Optional. A query string for filtering `UserInvitation` results by their current state, in the format: `\"state=='invited'\"`.",
// "location": "query",
// "type": "string"
// },
// "orderBy": {
// "description": "Optional. The sort order of the list results. You can sort the results in descending order based on either email or last update timestamp but not both, using `order_by=\"email desc\"`. Currently, sorting is supported for `update_time asc`, `update_time desc`, `email asc`, and `email desc`. If not specified, results will be returned based on `email asc` order.",
// "location": "query",
// "type": "string"
// },
// "pageSize": {
// "description": "Optional. The maximum number of UserInvitation resources to return. If unspecified, at most 100 resources will be returned. The maximum value is 200; values above 200 will be set to 200.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "Optional. A page token, received from a previous `ListUserInvitations` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBooks` must match the call that provided the page token.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. The customer ID of the Google Workspace or Cloud Identity account the UserInvitation resources are associated with.",
// "location": "path",
// "pattern": "^customers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/userinvitations",
// "response": {
// "$ref": "ListUserInvitationsResponse"
// }
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *CustomersUserinvitationsListCall) Pages(ctx context.Context, f func(*ListUserInvitationsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.customers.userinvitations.send":
type CustomersUserinvitationsSendCall struct {
s *Service
name string
senduserinvitationrequest *SendUserInvitationRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Send: Sends a UserInvitation to email. If the `UserInvitation` does
// not exist for this request and it is a valid request, the request
// creates a `UserInvitation`. **Note:** The `get` and `list` methods
// have a 48-hour delay where newly-created consumer accounts will not
// appear in the results. You can still send a `UserInvitation` to those
// accounts if you know the unmanaged email address and
// IsInvitableUser==True.
//
// - name: `UserInvitation` name in the format
// `customers/{customer}/userinvitations/{user_email_address}`.
func (r *CustomersUserinvitationsService) Send(name string, senduserinvitationrequest *SendUserInvitationRequest) *CustomersUserinvitationsSendCall {
c := &CustomersUserinvitationsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.senduserinvitationrequest = senduserinvitationrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *CustomersUserinvitationsSendCall) Fields(s ...googleapi.Field) *CustomersUserinvitationsSendCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *CustomersUserinvitationsSendCall) Context(ctx context.Context) *CustomersUserinvitationsSendCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *CustomersUserinvitationsSendCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *CustomersUserinvitationsSendCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.senduserinvitationrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:send")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.customers.userinvitations.send" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *CustomersUserinvitationsSendCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Sends a UserInvitation to email. If the `UserInvitation` does not exist for this request and it is a valid request, the request creates a `UserInvitation`. **Note:** The `get` and `list` methods have a 48-hour delay where newly-created consumer accounts will not appear in the results. You can still send a `UserInvitation` to those accounts if you know the unmanaged email address and IsInvitableUser==True.",
// "flatPath": "v1/customers/{customersId}/userinvitations/{userinvitationsId}:send",
// "httpMethod": "POST",
// "id": "cloudidentity.customers.userinvitations.send",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`",
// "location": "path",
// "pattern": "^customers/[^/]+/userinvitations/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:send",
// "request": {
// "$ref": "SendUserInvitationRequest"
// },
// "response": {
// "$ref": "Operation"
// }
// }
}
// method id "cloudidentity.devices.cancelWipe":
type DevicesCancelWipeCall struct {
s *Service
name string
googleappscloudidentitydevicesv1cancelwipedevicerequest *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// CancelWipe: Cancels an unfinished device wipe. This operation can be
// used to cancel device wipe in the gap between the wipe operation
// returning success and the device being wiped. This operation is
// possible when the device is in a "pending wipe" state. The device
// enters the "pending wipe" state when a wipe device command is issued,
// but has not yet been sent to the device. The cancel wipe will fail if
// the wipe command has already been issued to the device.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}`, where device is the unique ID
// assigned to the Device.
func (r *DevicesService) CancelWipe(name string, googleappscloudidentitydevicesv1cancelwipedevicerequest *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest) *DevicesCancelWipeCall {
c := &DevicesCancelWipeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1cancelwipedevicerequest = googleappscloudidentitydevicesv1cancelwipedevicerequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesCancelWipeCall) Fields(s ...googleapi.Field) *DevicesCancelWipeCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesCancelWipeCall) Context(ctx context.Context) *DevicesCancelWipeCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesCancelWipeCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesCancelWipeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1cancelwipedevicerequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancelWipe")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.cancelWipe" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesCancelWipeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Cancels an unfinished device wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped. This operation is possible when the device is in a \"pending wipe\" state. The device enters the \"pending wipe\" state when a wipe device command is issued, but has not yet been sent to the device. The cancel wipe will fail if the wipe command has already been issued to the device.",
// "flatPath": "v1/devices/{devicesId}:cancelWipe",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.cancelWipe",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.",
// "location": "path",
// "pattern": "^devices/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:cancelWipe",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.create":
type DevicesCreateCall struct {
s *Service
googleappscloudidentitydevicesv1device *GoogleAppsCloudidentityDevicesV1Device
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a device. Only company-owned device may be created.
// **Note**: This method is available only to customers who have one of
// the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise
// for Education, and Cloud Identity Premium
func (r *DevicesService) Create(googleappscloudidentitydevicesv1device *GoogleAppsCloudidentityDevicesV1Device) *DevicesCreateCall {
c := &DevicesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.googleappscloudidentitydevicesv1device = googleappscloudidentitydevicesv1device
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesCreateCall) Customer(customer string) *DevicesCreateCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesCreateCall) Fields(s ...googleapi.Field) *DevicesCreateCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesCreateCall) Context(ctx context.Context) *DevicesCreateCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1device)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/devices")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.create" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a device. Only company-owned device may be created. **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium",
// "flatPath": "v1/devices",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.create",
// "parameterOrder": [],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/devices",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1Device"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.delete":
type DevicesDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes the specified device.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}`, where device is the unique ID
// assigned to the Device.
func (r *DevicesService) Delete(name string) *DevicesDeleteCall {
c := &DevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeleteCall) Customer(customer string) *DevicesDeleteCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeleteCall) Fields(s ...googleapi.Field) *DevicesDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeleteCall) Context(ctx context.Context) *DevicesDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes the specified device.",
// "flatPath": "v1/devices/{devicesId}",
// "httpMethod": "DELETE",
// "id": "cloudidentity.devices.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.",
// "location": "path",
// "pattern": "^devices/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.get":
type DevicesGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves the specified device.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in the format: `devices/{device}`, where device is the unique ID
// assigned to the Device.
func (r *DevicesService) Get(name string) *DevicesGetCall {
c := &DevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Customer
// in the format: `customers/{customer}`, where customer is the customer
// to whom the device belongs. If you're using this API for your own
// organization, use `customers/my_customer`. If you're using this API
// to manage another organization, use `customers/{customer}`, where
// customer is the customer to whom the device belongs.
func (c *DevicesGetCall) Customer(customer string) *DevicesGetCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesGetCall) Fields(s ...googleapi.Field) *DevicesGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesGetCall) IfNoneMatch(entityTag string) *DevicesGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesGetCall) Context(ctx context.Context) *DevicesGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.get" call.
// Exactly one of *GoogleAppsCloudidentityDevicesV1Device or error will
// be non-nil. Any non-2xx status code is an error. Response headers are
// in either
// *GoogleAppsCloudidentityDevicesV1Device.ServerResponse.Header or (if
// a response was returned at all) in error.(*googleapi.Error).Header.
// Use googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *DevicesGetCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1Device, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1Device{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves the specified device.",
// "flatPath": "v1/devices/{devicesId}",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in the format: `devices/{device}`, where device is the unique ID assigned to the Device.",
// "location": "path",
// "pattern": "^devices/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1Device"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// method id "cloudidentity.devices.list":
type DevicesListCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists/Searches devices.
func (r *DevicesService) List() *DevicesListCall {
c := &DevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the customer
// in the format: `customers/{customer}`, where customer is the customer
// to whom the device belongs. If you're using this API for your own
// organization, use `customers/my_customer`. If you're using this API
// to manage another organization, use `customers/{customer}`, where
// customer is the customer to whom the device belongs.
func (c *DevicesListCall) Customer(customer string) *DevicesListCall {
c.urlParams_.Set("customer", customer)
return c
}
// Filter sets the optional parameter "filter": Additional restrictions
// when fetching list of devices. For a list of search fields, refer to
// Mobile device search fields
// (https://developers.google.com/admin-sdk/directory/v1/search-operators).
// Multiple search fields are separated by the space character.
func (c *DevicesListCall) Filter(filter string) *DevicesListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Order specification
// for devices in the response. Only one of the following field names
// may be used to specify the order: `create_time`, `last_sync_time`,
// `model`, `os_version`, `device_type` and `serial_number`. `desc` may
// be specified optionally at the end to specify results to be sorted in
// descending order. Default order is ascending.
func (c *DevicesListCall) OrderBy(orderBy string) *DevicesListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of Devices to return. If unspecified, at most 20 Devices will be
// returned. The maximum value is 100; values above 100 will be coerced
// to 100.
func (c *DevicesListCall) PageSize(pageSize int64) *DevicesListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": A page token,
// received from a previous `ListDevices` call. Provide this to retrieve
// the subsequent page. When paginating, all other parameters provided
// to `ListDevices` must match the call that provided the page token.
func (c *DevicesListCall) PageToken(pageToken string) *DevicesListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// View sets the optional parameter "view": The view to use for the List
// request.
//
// Possible values:
//
// "VIEW_UNSPECIFIED" - Default value. The value is unused.
// "COMPANY_INVENTORY" - This view contains all devices imported by
//
// the company admin. Each device in the response contains all
// information specified by the company admin when importing the device
// (i.e. asset tags). This includes devices that may be unaassigned or
// assigned to users.
//
// "USER_ASSIGNED_DEVICES" - This view contains all devices with at
//
// least one user registered on the device. Each device in the response
// contains all device information, except for asset tags.
func (c *DevicesListCall) View(view string) *DevicesListCall {
c.urlParams_.Set("view", view)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesListCall) Fields(s ...googleapi.Field) *DevicesListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesListCall) IfNoneMatch(entityTag string) *DevicesListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesListCall) Context(ctx context.Context) *DevicesListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/devices")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.list" call.
// Exactly one of *GoogleAppsCloudidentityDevicesV1ListDevicesResponse
// or error will be non-nil. Any non-2xx status code is an error.
// Response headers are in either
// *GoogleAppsCloudidentityDevicesV1ListDevicesResponse.ServerResponse.He
// ader or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesListCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1ListDevicesResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1ListDevicesResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists/Searches devices.",
// "flatPath": "v1/devices",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.list",
// "parameterOrder": [],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "filter": {
// "description": "Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.",
// "location": "query",
// "type": "string"
// },
// "orderBy": {
// "description": "Optional. Order specification for devices in the response. Only one of the following field names may be used to specify the order: `create_time`, `last_sync_time`, `model`, `os_version`, `device_type` and `serial_number`. `desc` may be specified optionally at the end to specify results to be sorted in descending order. Default order is ascending.",
// "location": "query",
// "type": "string"
// },
// "pageSize": {
// "description": "Optional. The maximum number of Devices to return. If unspecified, at most 20 Devices will be returned. The maximum value is 100; values above 100 will be coerced to 100.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "Optional. A page token, received from a previous `ListDevices` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDevices` must match the call that provided the page token.",
// "location": "query",
// "type": "string"
// },
// "view": {
// "description": "Optional. The view to use for the List request.",
// "enum": [
// "VIEW_UNSPECIFIED",
// "COMPANY_INVENTORY",
// "USER_ASSIGNED_DEVICES"
// ],
// "enumDescriptions": [
// "Default value. The value is unused.",
// "This view contains all devices imported by the company admin. Each device in the response contains all information specified by the company admin when importing the device (i.e. asset tags). This includes devices that may be unaassigned or assigned to users.",
// "This view contains all devices with at least one user registered on the device. Each device in the response contains all device information, except for asset tags."
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/devices",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ListDevicesResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *DevicesListCall) Pages(ctx context.Context, f func(*GoogleAppsCloudidentityDevicesV1ListDevicesResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.devices.wipe":
type DevicesWipeCall struct {
s *Service
name string
googleappscloudidentitydevicesv1wipedevicerequest *GoogleAppsCloudidentityDevicesV1WipeDeviceRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Wipe: Wipes all data on the specified device.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesService) Wipe(name string, googleappscloudidentitydevicesv1wipedevicerequest *GoogleAppsCloudidentityDevicesV1WipeDeviceRequest) *DevicesWipeCall {
c := &DevicesWipeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1wipedevicerequest = googleappscloudidentitydevicesv1wipedevicerequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesWipeCall) Fields(s ...googleapi.Field) *DevicesWipeCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesWipeCall) Context(ctx context.Context) *DevicesWipeCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesWipeCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesWipeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1wipedevicerequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:wipe")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.wipe" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesWipeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Wipes all data on the specified device.",
// "flatPath": "v1/devices/{devicesId}:wipe",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.wipe",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:wipe",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1WipeDeviceRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.approve":
type DevicesDeviceUsersApproveCall struct {
s *Service
name string
googleappscloudidentitydevicesv1approvedeviceuserrequest *GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Approve: Approves device to access user data.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) Approve(name string, googleappscloudidentitydevicesv1approvedeviceuserrequest *GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest) *DevicesDeviceUsersApproveCall {
c := &DevicesDeviceUsersApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1approvedeviceuserrequest = googleappscloudidentitydevicesv1approvedeviceuserrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersApproveCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersApproveCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersApproveCall) Context(ctx context.Context) *DevicesDeviceUsersApproveCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersApproveCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersApproveCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1approvedeviceuserrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:approve")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.approve" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersApproveCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Approves device to access user data.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}:approve",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.deviceUsers.approve",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:approve",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.block":
type DevicesDeviceUsersBlockCall struct {
s *Service
name string
googleappscloudidentitydevicesv1blockdeviceuserrequest *GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Block: Blocks device from accessing user data
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) Block(name string, googleappscloudidentitydevicesv1blockdeviceuserrequest *GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest) *DevicesDeviceUsersBlockCall {
c := &DevicesDeviceUsersBlockCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1blockdeviceuserrequest = googleappscloudidentitydevicesv1blockdeviceuserrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersBlockCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersBlockCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersBlockCall) Context(ctx context.Context) *DevicesDeviceUsersBlockCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersBlockCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersBlockCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1blockdeviceuserrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:block")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.block" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersBlockCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Blocks device from accessing user data",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}:block",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.deviceUsers.block",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:block",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.cancelWipe":
type DevicesDeviceUsersCancelWipeCall struct {
s *Service
name string
googleappscloudidentitydevicesv1cancelwipedeviceuserrequest *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// CancelWipe: Cancels an unfinished user account wipe. This operation
// can be used to cancel device wipe in the gap between the wipe
// operation returning success and the device being wiped.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) CancelWipe(name string, googleappscloudidentitydevicesv1cancelwipedeviceuserrequest *GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest) *DevicesDeviceUsersCancelWipeCall {
c := &DevicesDeviceUsersCancelWipeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1cancelwipedeviceuserrequest = googleappscloudidentitydevicesv1cancelwipedeviceuserrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersCancelWipeCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersCancelWipeCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersCancelWipeCall) Context(ctx context.Context) *DevicesDeviceUsersCancelWipeCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersCancelWipeCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersCancelWipeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1cancelwipedeviceuserrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancelWipe")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.cancelWipe" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersCancelWipeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Cancels an unfinished user account wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}:cancelWipe",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.deviceUsers.cancelWipe",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:cancelWipe",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.delete":
type DevicesDeviceUsersDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes the specified DeviceUser. This also revokes the
// user's access to device data.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) Delete(name string) *DevicesDeviceUsersDeleteCall {
c := &DevicesDeviceUsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersDeleteCall) Customer(customer string) *DevicesDeviceUsersDeleteCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersDeleteCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersDeleteCall) Context(ctx context.Context) *DevicesDeviceUsersDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes the specified DeviceUser. This also revokes the user's access to device data.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}",
// "httpMethod": "DELETE",
// "id": "cloudidentity.devices.deviceUsers.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.get":
type DevicesDeviceUsersGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves the specified DeviceUser
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) Get(name string) *DevicesDeviceUsersGetCall {
c := &DevicesDeviceUsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersGetCall) Customer(customer string) *DevicesDeviceUsersGetCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersGetCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesDeviceUsersGetCall) IfNoneMatch(entityTag string) *DevicesDeviceUsersGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersGetCall) Context(ctx context.Context) *DevicesDeviceUsersGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.get" call.
// Exactly one of *GoogleAppsCloudidentityDevicesV1DeviceUser or error
// will be non-nil. Any non-2xx status code is an error. Response
// headers are in either
// *GoogleAppsCloudidentityDevicesV1DeviceUser.ServerResponse.Header or
// (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesDeviceUsersGetCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1DeviceUser, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1DeviceUser{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves the specified DeviceUser",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.deviceUsers.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1DeviceUser"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.list":
type DevicesDeviceUsersListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists/Searches DeviceUsers.
//
// - parent: To list all DeviceUsers, set this to "devices/-". To list
// all DeviceUsers owned by a device, set this to the resource name of
// the device. Format: devices/{device}.
func (r *DevicesDeviceUsersService) List(parent string) *DevicesDeviceUsersListCall {
c := &DevicesDeviceUsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersListCall) Customer(customer string) *DevicesDeviceUsersListCall {
c.urlParams_.Set("customer", customer)
return c
}
// Filter sets the optional parameter "filter": Additional restrictions
// when fetching list of devices. For a list of search fields, refer to
// Mobile device search fields
// (https://developers.google.com/admin-sdk/directory/v1/search-operators).
// Multiple search fields are separated by the space character.
func (c *DevicesDeviceUsersListCall) Filter(filter string) *DevicesDeviceUsersListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Order specification
// for devices in the response.
func (c *DevicesDeviceUsersListCall) OrderBy(orderBy string) *DevicesDeviceUsersListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of DeviceUsers to return. If unspecified, at most 5 DeviceUsers will
// be returned. The maximum value is 20; values above 20 will be coerced
// to 20.
func (c *DevicesDeviceUsersListCall) PageSize(pageSize int64) *DevicesDeviceUsersListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": A page token,
// received from a previous `ListDeviceUsers` call. Provide this to
// retrieve the subsequent page. When paginating, all other parameters
// provided to `ListBooks` must match the call that provided the page
// token.
func (c *DevicesDeviceUsersListCall) PageToken(pageToken string) *DevicesDeviceUsersListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersListCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesDeviceUsersListCall) IfNoneMatch(entityTag string) *DevicesDeviceUsersListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersListCall) Context(ctx context.Context) *DevicesDeviceUsersListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/deviceUsers")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.list" call.
// Exactly one of
// *GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse or error
// will be non-nil. Any non-2xx status code is an error. Response
// headers are in either
// *GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse.ServerRespons
// e.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesDeviceUsersListCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists/Searches DeviceUsers.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.deviceUsers.list",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "filter": {
// "description": "Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.",
// "location": "query",
// "type": "string"
// },
// "orderBy": {
// "description": "Optional. Order specification for devices in the response.",
// "location": "query",
// "type": "string"
// },
// "pageSize": {
// "description": "Optional. The maximum number of DeviceUsers to return. If unspecified, at most 5 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "Optional. A page token, received from a previous `ListDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBooks` must match the call that provided the page token.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. To list all DeviceUsers, set this to \"devices/-\". To list all DeviceUsers owned by a device, set this to the resource name of the device. Format: devices/{device}",
// "location": "path",
// "pattern": "^devices/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/deviceUsers",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *DevicesDeviceUsersListCall) Pages(ctx context.Context, f func(*GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.devices.deviceUsers.lookup":
type DevicesDeviceUsersLookupCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Lookup: Looks up resource names of the DeviceUsers associated with
// the caller's credentials, as well as the properties provided in the
// request. This method must be called with end-user credentials with
// the scope:
// https://www.googleapis.com/auth/cloud-identity.devices.lookup If
// multiple properties are provided, only DeviceUsers having all of
// these properties are considered as matches - i.e. the query behaves
// like an AND. Different platforms require different amounts of
// information from the caller to ensure that the DeviceUser is uniquely
// identified. - iOS: No properties need to be passed, the caller's
// credentials are sufficient to identify the corresponding DeviceUser.
// - Android: Specifying the 'android_id' field is required. - Desktop:
// Specifying the 'raw_resource_id' field is required.
//
// - parent: Must be set to "devices/-/deviceUsers" to search across all
// DeviceUser belonging to the user.
func (r *DevicesDeviceUsersService) Lookup(parent string) *DevicesDeviceUsersLookupCall {
c := &DevicesDeviceUsersLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// AndroidId sets the optional parameter "androidId": Android Id
// returned by Settings.Secure#ANDROID_ID
// (https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
func (c *DevicesDeviceUsersLookupCall) AndroidId(androidId string) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("androidId", androidId)
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of DeviceUsers to return. If unspecified, at most 20 DeviceUsers will
// be returned. The maximum value is 20; values above 20 will be coerced
// to 20.
func (c *DevicesDeviceUsersLookupCall) PageSize(pageSize int64) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": A page token,
// received from a previous `LookupDeviceUsers` call. Provide this to
// retrieve the subsequent page. When paginating, all other parameters
// provided to `LookupDeviceUsers` must match the call that provided the
// page token.
func (c *DevicesDeviceUsersLookupCall) PageToken(pageToken string) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// RawResourceId sets the optional parameter "rawResourceId": Raw
// Resource Id used by Google Endpoint Verification. If the user is
// enrolled into Google Endpoint Verification, this id will be saved as
// the 'device_resource_id' field in the following platform dependent
// files. Mac: ~/.secureConnect/context_aware_config.json Windows:
// C:\Users\%USERPROFILE%\.secureConnect\context_aware_config.json
// Linux: ~/.secureConnect/context_aware_config.json
func (c *DevicesDeviceUsersLookupCall) RawResourceId(rawResourceId string) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("rawResourceId", rawResourceId)
return c
}
// UserId sets the optional parameter "userId": The user whose
// DeviceUser's resource name will be fetched. Must be set to 'me' to
// fetch the DeviceUser's resource name for the calling user.
func (c *DevicesDeviceUsersLookupCall) UserId(userId string) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("userId", userId)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersLookupCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersLookupCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesDeviceUsersLookupCall) IfNoneMatch(entityTag string) *DevicesDeviceUsersLookupCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersLookupCall) Context(ctx context.Context) *DevicesDeviceUsersLookupCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersLookupCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersLookupCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:lookup")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.lookup" call.
// Exactly one of
// *GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse or
// error will be non-nil. Any non-2xx status code is an error. Response
// headers are in either
// *GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse.ServerR
// esponse.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesDeviceUsersLookupCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Looks up resource names of the DeviceUsers associated with the caller's credentials, as well as the properties provided in the request. This method must be called with end-user credentials with the scope: https://www.googleapis.com/auth/cloud-identity.devices.lookup If multiple properties are provided, only DeviceUsers having all of these properties are considered as matches - i.e. the query behaves like an AND. Different platforms require different amounts of information from the caller to ensure that the DeviceUser is uniquely identified. - iOS: No properties need to be passed, the caller's credentials are sufficient to identify the corresponding DeviceUser. - Android: Specifying the 'android_id' field is required. - Desktop: Specifying the 'raw_resource_id' field is required.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers:lookup",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.deviceUsers.lookup",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "androidId": {
// "description": "Android Id returned by [Settings.Secure#ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).",
// "location": "query",
// "type": "string"
// },
// "pageSize": {
// "description": "The maximum number of DeviceUsers to return. If unspecified, at most 20 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "A page token, received from a previous `LookupDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `LookupDeviceUsers` must match the call that provided the page token.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Must be set to \"devices/-/deviceUsers\" to search across all DeviceUser belonging to the user.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers$",
// "required": true,
// "type": "string"
// },
// "rawResourceId": {
// "description": "Raw Resource Id used by Google Endpoint Verification. If the user is enrolled into Google Endpoint Verification, this id will be saved as the 'device_resource_id' field in the following platform dependent files. Mac: ~/.secureConnect/context_aware_config.json Windows: C:\\Users\\%USERPROFILE%\\.secureConnect\\context_aware_config.json Linux: ~/.secureConnect/context_aware_config.json",
// "location": "query",
// "type": "string"
// },
// "userId": {
// "description": "The user whose DeviceUser's resource name will be fetched. Must be set to 'me' to fetch the DeviceUser's resource name for the calling user.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+parent}:lookup",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices.lookup"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *DevicesDeviceUsersLookupCall) Pages(ctx context.Context, f func(*GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.devices.deviceUsers.wipe":
type DevicesDeviceUsersWipeCall struct {
s *Service
name string
googleappscloudidentitydevicesv1wipedeviceuserrequest *GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Wipe: Wipes the user's account on a device. Other data on the device
// that is not associated with the user's work account is not affected.
// For example, if a Gmail app is installed on a device that is used for
// personal and work purposes, and the user is logged in to the Gmail
// app with their personal account as well as their work account, wiping
// the "deviceUser" by their work administrator will not affect their
// personal account within Gmail or other apps such as Photos.
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the Device
// in format: `devices/{device}/deviceUsers/{device_user}`, where
// device is the unique ID assigned to the Device, and device_user is
// the unique ID assigned to the User.
func (r *DevicesDeviceUsersService) Wipe(name string, googleappscloudidentitydevicesv1wipedeviceuserrequest *GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest) *DevicesDeviceUsersWipeCall {
c := &DevicesDeviceUsersWipeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1wipedeviceuserrequest = googleappscloudidentitydevicesv1wipedeviceuserrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersWipeCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersWipeCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersWipeCall) Context(ctx context.Context) *DevicesDeviceUsersWipeCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersWipeCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersWipeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1wipedeviceuserrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:wipe")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.wipe" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersWipeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Wipes the user's account on a device. Other data on the device that is not associated with the user's work account is not affected. For example, if a Gmail app is installed on a device that is used for personal and work purposes, and the user is logged in to the Gmail app with their personal account as well as their work account, wiping the \"deviceUser\" by their work administrator will not affect their personal account within Gmail or other apps such as Photos.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}:wipe",
// "httpMethod": "POST",
// "id": "cloudidentity.devices.deviceUsers.wipe",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:wipe",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.clientStates.get":
type DevicesDeviceUsersClientStatesGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets the client state for the device user
//
// - name: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// ClientState in format:
// `devices/{device}/deviceUsers/{device_user}/clientStates/{partner}`,
// where `device` is the unique ID assigned to the Device,
// `device_user` is the unique ID assigned to the User and `partner`
// identifies the partner storing the data. To get the client state
// for devices belonging to your own organization, the `partnerId` is
// in the format: `customerId-*anystring*`. Where the `customerId` is
// your organization's customer ID and `anystring` is any suffix. This
// suffix is used in setting up Custom Access Levels in Context-Aware
// Access. You may use `my_customer` instead of the customer ID for
// devices managed by your own organization. You may specify `-` in
// place of the `{device}`, so the ClientState resource name can be:
// `devices/-/deviceUsers/{device_user_resource}/clientStates/{partner}
// `.
func (r *DevicesDeviceUsersClientStatesService) Get(name string) *DevicesDeviceUsersClientStatesGetCall {
c := &DevicesDeviceUsersClientStatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersClientStatesGetCall) Customer(customer string) *DevicesDeviceUsersClientStatesGetCall {
c.urlParams_.Set("customer", customer)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersClientStatesGetCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersClientStatesGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesDeviceUsersClientStatesGetCall) IfNoneMatch(entityTag string) *DevicesDeviceUsersClientStatesGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersClientStatesGetCall) Context(ctx context.Context) *DevicesDeviceUsersClientStatesGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersClientStatesGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersClientStatesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.clientStates.get" call.
// Exactly one of *GoogleAppsCloudidentityDevicesV1ClientState or error
// will be non-nil. Any non-2xx status code is an error. Response
// headers are in either
// *GoogleAppsCloudidentityDevicesV1ClientState.ServerResponse.Header or
// (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesDeviceUsersClientStatesGetCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1ClientState, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1ClientState{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the client state for the device user",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}/clientStates/{clientStatesId}",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.deviceUsers.clientStates.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientStates/{partner}`, where `device` is the unique ID assigned to the Device, `device_user` is the unique ID assigned to the User and `partner` identifies the partner storing the data. To get the client state for devices belonging to your own organization, the `partnerId` is in the format: `customerId-*anystring*`. Where the `customerId` is your organization's customer ID and `anystring` is any suffix. This suffix is used in setting up Custom Access Levels in Context-Aware Access. You may use `my_customer` instead of the customer ID for devices managed by your own organization. You may specify `-` in place of the `{device}`, so the ClientState resource name can be: `devices/-/deviceUsers/{device_user_resource}/clientStates/{partner}`.",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+/clientStates/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ClientState"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// method id "cloudidentity.devices.deviceUsers.clientStates.list":
type DevicesDeviceUsersClientStatesListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists the client states for the given search query.
//
// - parent: To list all ClientStates, set this to
// "devices/-/deviceUsers/-". To list all ClientStates owned by a
// DeviceUser, set this to the resource name of the DeviceUser.
// Format: devices/{device}/deviceUsers/{deviceUser}.
func (r *DevicesDeviceUsersClientStatesService) List(parent string) *DevicesDeviceUsersClientStatesListCall {
c := &DevicesDeviceUsersClientStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersClientStatesListCall) Customer(customer string) *DevicesDeviceUsersClientStatesListCall {
c.urlParams_.Set("customer", customer)
return c
}
// Filter sets the optional parameter "filter": Additional restrictions
// when fetching list of client states.
func (c *DevicesDeviceUsersClientStatesListCall) Filter(filter string) *DevicesDeviceUsersClientStatesListCall {
c.urlParams_.Set("filter", filter)
return c
}
// OrderBy sets the optional parameter "orderBy": Order specification
// for client states in the response.
func (c *DevicesDeviceUsersClientStatesListCall) OrderBy(orderBy string) *DevicesDeviceUsersClientStatesListCall {
c.urlParams_.Set("orderBy", orderBy)
return c
}
// PageToken sets the optional parameter "pageToken": A page token,
// received from a previous `ListClientStates` call. Provide this to
// retrieve the subsequent page. When paginating, all other parameters
// provided to `ListClientStates` must match the call that provided the
// page token.
func (c *DevicesDeviceUsersClientStatesListCall) PageToken(pageToken string) *DevicesDeviceUsersClientStatesListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersClientStatesListCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersClientStatesListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *DevicesDeviceUsersClientStatesListCall) IfNoneMatch(entityTag string) *DevicesDeviceUsersClientStatesListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersClientStatesListCall) Context(ctx context.Context) *DevicesDeviceUsersClientStatesListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersClientStatesListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersClientStatesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/clientStates")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.clientStates.list" call.
// Exactly one of
// *GoogleAppsCloudidentityDevicesV1ListClientStatesResponse or error
// will be non-nil. Any non-2xx status code is an error. Response
// headers are in either
// *GoogleAppsCloudidentityDevicesV1ListClientStatesResponse.ServerRespon
// se.Header or (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *DevicesDeviceUsersClientStatesListCall) Do(opts ...googleapi.CallOption) (*GoogleAppsCloudidentityDevicesV1ListClientStatesResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &GoogleAppsCloudidentityDevicesV1ListClientStatesResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists the client states for the given search query.",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}/clientStates",
// "httpMethod": "GET",
// "id": "cloudidentity.devices.deviceUsers.clientStates.list",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "filter": {
// "description": "Optional. Additional restrictions when fetching list of client states.",
// "location": "query",
// "type": "string"
// },
// "orderBy": {
// "description": "Optional. Order specification for client states in the response.",
// "location": "query",
// "type": "string"
// },
// "pageToken": {
// "description": "Optional. A page token, received from a previous `ListClientStates` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListClientStates` must match the call that provided the page token.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. To list all ClientStates, set this to \"devices/-/deviceUsers/-\". To list all ClientStates owned by a DeviceUser, set this to the resource name of the DeviceUser. Format: devices/{device}/deviceUsers/{deviceUser}",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/clientStates",
// "response": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ListClientStatesResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices",
// "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *DevicesDeviceUsersClientStatesListCall) Pages(ctx context.Context, f func(*GoogleAppsCloudidentityDevicesV1ListClientStatesResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.devices.deviceUsers.clientStates.patch":
type DevicesDeviceUsersClientStatesPatchCall struct {
s *Service
name string
googleappscloudidentitydevicesv1clientstate *GoogleAppsCloudidentityDevicesV1ClientState
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Patch: Updates the client state for the device user **Note**: This
// method is available only to customers who have one of the following
// SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education,
// and Cloud Identity Premium
//
// - name: Output only. Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// ClientState in format:
// `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`,
// where partner corresponds to the partner storing the data. For
// partners belonging to the "BeyondCorp Alliance", this is the
// partner ID specified to you by Google. For all other callers, this
// is a string of the form: `{customer}-suffix`, where `customer` is
// your customer ID. The *suffix* is any string the caller specifies.
// This string will be displayed verbatim in the administration
// console. This suffix is used in setting up Custom Access Levels in
// Context-Aware Access. Your organization's customer ID can be
// obtained from the URL: `GET
// https://www.googleapis.com/admin/directory/v1/customers/my_customer`
// The `id` field in the response contains the customer ID starting
// with the letter 'C'. The customer ID to be used in this API is the
// string after the letter 'C' (not including 'C').
func (r *DevicesDeviceUsersClientStatesService) Patch(name string, googleappscloudidentitydevicesv1clientstate *GoogleAppsCloudidentityDevicesV1ClientState) *DevicesDeviceUsersClientStatesPatchCall {
c := &DevicesDeviceUsersClientStatesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.googleappscloudidentitydevicesv1clientstate = googleappscloudidentitydevicesv1clientstate
return c
}
// Customer sets the optional parameter "customer": Resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// customer. If you're using this API for your own organization, use
// `customers/my_customer` If you're using this API to manage another
// organization, use `customers/{customer}`, where customer is the
// customer to whom the device belongs.
func (c *DevicesDeviceUsersClientStatesPatchCall) Customer(customer string) *DevicesDeviceUsersClientStatesPatchCall {
c.urlParams_.Set("customer", customer)
return c
}
// UpdateMask sets the optional parameter "updateMask": Comma-separated
// list of fully qualified names of fields to be updated. If not
// specified, all updatable fields in ClientState are updated.
func (c *DevicesDeviceUsersClientStatesPatchCall) UpdateMask(updateMask string) *DevicesDeviceUsersClientStatesPatchCall {
c.urlParams_.Set("updateMask", updateMask)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DevicesDeviceUsersClientStatesPatchCall) Fields(s ...googleapi.Field) *DevicesDeviceUsersClientStatesPatchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *DevicesDeviceUsersClientStatesPatchCall) Context(ctx context.Context) *DevicesDeviceUsersClientStatesPatchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *DevicesDeviceUsersClientStatesPatchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *DevicesDeviceUsersClientStatesPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleappscloudidentitydevicesv1clientstate)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("PATCH", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.devices.deviceUsers.clientStates.patch" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *DevicesDeviceUsersClientStatesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Updates the client state for the device user **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium",
// "flatPath": "v1/devices/{devicesId}/deviceUsers/{deviceUsersId}/clientStates/{clientStatesId}",
// "httpMethod": "PATCH",
// "id": "cloudidentity.devices.deviceUsers.clientStates.patch",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "customer": {
// "description": "Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.",
// "location": "query",
// "type": "string"
// },
// "name": {
// "description": "Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`, where partner corresponds to the partner storing the data. For partners belonging to the \"BeyondCorp Alliance\", this is the partner ID specified to you by Google. For all other callers, this is a string of the form: `{customer}-suffix`, where `customer` is your customer ID. The *suffix* is any string the caller specifies. This string will be displayed verbatim in the administration console. This suffix is used in setting up Custom Access Levels in Context-Aware Access. Your organization's customer ID can be obtained from the URL: `GET https://www.googleapis.com/admin/directory/v1/customers/my_customer` The `id` field in the response contains the customer ID starting with the letter 'C'. The customer ID to be used in this API is the string after the letter 'C' (not including 'C')",
// "location": "path",
// "pattern": "^devices/[^/]+/deviceUsers/[^/]+/clientStates/[^/]+$",
// "required": true,
// "type": "string"
// },
// "updateMask": {
// "description": "Optional. Comma-separated list of fully qualified names of fields to be updated. If not specified, all updatable fields in ClientState are updated.",
// "format": "google-fieldmask",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "request": {
// "$ref": "GoogleAppsCloudidentityDevicesV1ClientState"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.devices"
// ]
// }
}
// method id "cloudidentity.groups.create":
type GroupsCreateCall struct {
s *Service
group *Group
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a Group.
func (r *GroupsService) Create(group *Group) *GroupsCreateCall {
c := &GroupsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.group = group
return c
}
// InitialGroupConfig sets the optional parameter "initialGroupConfig":
// The initial configuration option for the `Group`.
//
// Possible values:
//
// "INITIAL_GROUP_CONFIG_UNSPECIFIED" - Default. Should not be used.
// "WITH_INITIAL_OWNER" - The end user making the request will be
//
// added as the initial owner of the `Group`.
//
// "EMPTY" - An empty group is created without any initial owners.
//
// This can only be used by admins of the domain.
func (c *GroupsCreateCall) InitialGroupConfig(initialGroupConfig string) *GroupsCreateCall {
c.urlParams_.Set("initialGroupConfig", initialGroupConfig)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsCreateCall) Fields(s ...googleapi.Field) *GroupsCreateCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsCreateCall) Context(ctx context.Context) *GroupsCreateCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.create" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a Group.",
// "flatPath": "v1/groups",
// "httpMethod": "POST",
// "id": "cloudidentity.groups.create",
// "parameterOrder": [],
// "parameters": {
// "initialGroupConfig": {
// "description": "Optional. The initial configuration option for the `Group`.",
// "enum": [
// "INITIAL_GROUP_CONFIG_UNSPECIFIED",
// "WITH_INITIAL_OWNER",
// "EMPTY"
// ],
// "enumDescriptions": [
// "Default. Should not be used.",
// "The end user making the request will be added as the initial owner of the `Group`.",
// "An empty group is created without any initial owners. This can only be used by admins of the domain."
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/groups",
// "request": {
// "$ref": "Group"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.delete":
type GroupsDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a `Group`.
//
// - name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Group` to retrieve. Must be of the form `groups/{group}`.
func (r *GroupsService) Delete(name string) *GroupsDeleteCall {
c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes a `Group`.",
// "flatPath": "v1/groups/{groupsId}",
// "httpMethod": "DELETE",
// "id": "cloudidentity.groups.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.get":
type GroupsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves a `Group`.
//
// - name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Group` to retrieve. Must be of the form `groups/{group}`.
func (r *GroupsService) Get(name string) *GroupsGetCall {
c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.get" call.
// Exactly one of *Group or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Group.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Group{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a `Group`.",
// "flatPath": "v1/groups/{groupsId}",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Group"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.getSecuritySettings":
type GroupsGetSecuritySettingsCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// GetSecuritySettings: Get Security Settings
//
// - name: The security settings to retrieve. Format:
// `groups/{group_id}/securitySettings`.
func (r *GroupsService) GetSecuritySettings(name string) *GroupsGetSecuritySettingsCall {
c := &GroupsGetSecuritySettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// ReadMask sets the optional parameter "readMask": Field-level read
// mask of which fields to return. "*" returns all fields. If not
// specified, all fields will be returned. May only contain the
// following field: `member_restriction`.
func (c *GroupsGetSecuritySettingsCall) ReadMask(readMask string) *GroupsGetSecuritySettingsCall {
c.urlParams_.Set("readMask", readMask)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsGetSecuritySettingsCall) Fields(s ...googleapi.Field) *GroupsGetSecuritySettingsCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsGetSecuritySettingsCall) IfNoneMatch(entityTag string) *GroupsGetSecuritySettingsCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsGetSecuritySettingsCall) Context(ctx context.Context) *GroupsGetSecuritySettingsCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsGetSecuritySettingsCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsGetSecuritySettingsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.getSecuritySettings" call.
// Exactly one of *SecuritySettings or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *SecuritySettings.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsGetSecuritySettingsCall) Do(opts ...googleapi.CallOption) (*SecuritySettings, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &SecuritySettings{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get Security Settings",
// "flatPath": "v1/groups/{groupsId}/securitySettings",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.getSecuritySettings",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The security settings to retrieve. Format: `groups/{group_id}/securitySettings`",
// "location": "path",
// "pattern": "^groups/[^/]+/securitySettings$",
// "required": true,
// "type": "string"
// },
// "readMask": {
// "description": "Field-level read mask of which fields to return. \"*\" returns all fields. If not specified, all fields will be returned. May only contain the following field: `member_restriction`.",
// "format": "google-fieldmask",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "SecuritySettings"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.list":
type GroupsListCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists the `Group` resources under a customer or namespace.
func (r *GroupsService) List() *GroupsListCall {
c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of results to return. Note that the number of results returned may be
// less than this value even if there are more available results. To
// fetch all results, clients must continue calling this method
// repeatedly until the response no longer contains a `next_page_token`.
// If unspecified, defaults to 200 for `View.BASIC` and to 50 for
// `View.FULL`. Must not be greater than 1000 for `View.BASIC` or 500
// for `View.FULL`.
func (c *GroupsListCall) PageSize(pageSize int64) *GroupsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// `next_page_token` value returned from a previous list request, if
// any.
func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Parent sets the optional parameter "parent": Required. The parent
// resource under which to list all `Group` resources. Must be of the
// form `identitysources/{identity_source}` for external-
// identity-mapped groups or `customers/{customer}` for Google Groups.
// The `customer` must begin with "C" (for example, 'C046psxkn').
func (c *GroupsListCall) Parent(parent string) *GroupsListCall {
c.urlParams_.Set("parent", parent)
return c
}
// View sets the optional parameter "view": The level of detail to be
// returned. If unspecified, defaults to `View.BASIC`.
//
// Possible values:
//
// "VIEW_UNSPECIFIED" - Default. Should not be used.
// "BASIC" - Only basic resource information is returned.
// "FULL" - All resource information is returned.
func (c *GroupsListCall) View(view string) *GroupsListCall {
c.urlParams_.Set("view", view)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.list" call.
// Exactly one of *ListGroupsResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListGroupsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*ListGroupsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListGroupsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists the `Group` resources under a customer or namespace.",
// "flatPath": "v1/groups",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.list",
// "parameterOrder": [],
// "parameters": {
// "pageSize": {
// "description": "The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `View.BASIC` and to 50 for `View.FULL`. Must not be greater than 1000 for `View.BASIC` or 500 for `View.FULL`.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The `next_page_token` value returned from a previous list request, if any.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. The parent resource under which to list all `Group` resources. Must be of the form `identitysources/{identity_source}` for external- identity-mapped groups or `customers/{customer}` for Google Groups. The `customer` must begin with \"C\" (for example, 'C046psxkn').",
// "location": "query",
// "type": "string"
// },
// "view": {
// "description": "The level of detail to be returned. If unspecified, defaults to `View.BASIC`.",
// "enum": [
// "VIEW_UNSPECIFIED",
// "BASIC",
// "FULL"
// ],
// "enumDescriptions": [
// "Default. Should not be used.",
// "Only basic resource information is returned.",
// "All resource information is returned."
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/groups",
// "response": {
// "$ref": "ListGroupsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *GroupsListCall) Pages(ctx context.Context, f func(*ListGroupsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.groups.lookup":
type GroupsLookupCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Lookup: Looks up the resource name
// (https://cloud.google.com/apis/design/resource_names) of a `Group` by
// its `EntityKey`.
func (r *GroupsService) Lookup() *GroupsLookupCall {
c := &GroupsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// GroupKeyId sets the optional parameter "groupKey.id": The ID of the
// entity. For Google-managed entities, the `id` should be the email
// address of an existing group or user. For external-identity-mapped
// entities, the `id` must be a string conforming to the Identity
// Source's requirements. Must be unique within a `namespace`.
func (c *GroupsLookupCall) GroupKeyId(groupKeyId string) *GroupsLookupCall {
c.urlParams_.Set("groupKey.id", groupKeyId)
return c
}
// GroupKeyNamespace sets the optional parameter "groupKey.namespace":
// The namespace in which the entity exists. If not specified, the
// `EntityKey` represents a Google-managed entity such as a Google user
// or a Google Group. If specified, the `EntityKey` represents an
// external-identity-mapped group. The namespace must correspond to an
// identity source created in Admin Console and must be in the form of
// `identitysources/{identity_source}`.
func (c *GroupsLookupCall) GroupKeyNamespace(groupKeyNamespace string) *GroupsLookupCall {
c.urlParams_.Set("groupKey.namespace", groupKeyNamespace)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsLookupCall) Fields(s ...googleapi.Field) *GroupsLookupCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsLookupCall) IfNoneMatch(entityTag string) *GroupsLookupCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsLookupCall) Context(ctx context.Context) *GroupsLookupCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsLookupCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsLookupCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups:lookup")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.lookup" call.
// Exactly one of *LookupGroupNameResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *LookupGroupNameResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsLookupCall) Do(opts ...googleapi.CallOption) (*LookupGroupNameResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &LookupGroupNameResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Group` by its `EntityKey`.",
// "flatPath": "v1/groups:lookup",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.lookup",
// "parameterOrder": [],
// "parameters": {
// "groupKey.id": {
// "description": "The ID of the entity. For Google-managed entities, the `id` should be the email address of an existing group or user. For external-identity-mapped entities, the `id` must be a string conforming to the Identity Source's requirements. Must be unique within a `namespace`.",
// "location": "query",
// "type": "string"
// },
// "groupKey.namespace": {
// "description": "The namespace in which the entity exists. If not specified, the `EntityKey` represents a Google-managed entity such as a Google user or a Google Group. If specified, the `EntityKey` represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of `identitysources/{identity_source}`.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/groups:lookup",
// "response": {
// "$ref": "LookupGroupNameResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.patch":
type GroupsPatchCall struct {
s *Service
name string
group *Group
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Patch: Updates a `Group`.
//
// - name: Output only. The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Group`. Shall be of the form `groups/{group}`.
func (r *GroupsService) Patch(name string, group *Group) *GroupsPatchCall {
c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.group = group
return c
}
// UpdateMask sets the optional parameter "updateMask": Required. The
// names of fields to update. May only contain the following field
// names: `display_name`, `description`, `labels`.
func (c *GroupsPatchCall) UpdateMask(updateMask string) *GroupsPatchCall {
c.urlParams_.Set("updateMask", updateMask)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsPatchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("PATCH", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.patch" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Updates a `Group`.",
// "flatPath": "v1/groups/{groupsId}",
// "httpMethod": "PATCH",
// "id": "cloudidentity.groups.patch",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// },
// "updateMask": {
// "description": "Required. The names of fields to update. May only contain the following field names: `display_name`, `description`, `labels`.",
// "format": "google-fieldmask",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "request": {
// "$ref": "Group"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.search":
type GroupsSearchCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Search: Searches for `Group` resources matching a specified query.
func (r *GroupsService) Search() *GroupsSearchCall {
c := &GroupsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of results to return. Note that the number of results returned may be
// less than this value even if there are more available results. To
// fetch all results, clients must continue calling this method
// repeatedly until the response no longer contains a `next_page_token`.
// If unspecified, defaults to 200 for `GroupView.BASIC` and 50 for
// `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC`
// or 500 for `GroupView.FULL`.
func (c *GroupsSearchCall) PageSize(pageSize int64) *GroupsSearchCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// `next_page_token` value returned from a previous search request, if
// any.
func (c *GroupsSearchCall) PageToken(pageToken string) *GroupsSearchCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Query sets the optional parameter "query": Required. The search
// query. Must be specified in Common Expression Language
// (https://opensource.google/projects/cel). May only contain equality
// operators on the parent and inclusion operators on labels (e.g.,
// `parent == 'customers/{customer}' &&
// 'cloudidentity.googleapis.com/groups.discussion_forum' in labels`).
// The `customer` must begin with "C" (for example, 'C046psxkn').
func (c *GroupsSearchCall) Query(query string) *GroupsSearchCall {
c.urlParams_.Set("query", query)
return c
}
// View sets the optional parameter "view": The level of detail to be
// returned. If unspecified, defaults to `View.BASIC`.
//
// Possible values:
//
// "VIEW_UNSPECIFIED" - Default. Should not be used.
// "BASIC" - Only basic resource information is returned.
// "FULL" - All resource information is returned.
func (c *GroupsSearchCall) View(view string) *GroupsSearchCall {
c.urlParams_.Set("view", view)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsSearchCall) Fields(s ...googleapi.Field) *GroupsSearchCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsSearchCall) IfNoneMatch(entityTag string) *GroupsSearchCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsSearchCall) Context(ctx context.Context) *GroupsSearchCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsSearchCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsSearchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups:search")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.search" call.
// Exactly one of *SearchGroupsResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *SearchGroupsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsSearchCall) Do(opts ...googleapi.CallOption) (*SearchGroupsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &SearchGroupsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Searches for `Group` resources matching a specified query.",
// "flatPath": "v1/groups:search",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.search",
// "parameterOrder": [],
// "parameters": {
// "pageSize": {
// "description": "The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC` or 500 for `GroupView.FULL`.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The `next_page_token` value returned from a previous search request, if any.",
// "location": "query",
// "type": "string"
// },
// "query": {
// "description": "Required. The search query. Must be specified in [Common Expression Language](https://opensource.google/projects/cel). May only contain equality operators on the parent and inclusion operators on labels (e.g., `parent == 'customers/{customer}' \u0026\u0026 'cloudidentity.googleapis.com/groups.discussion_forum' in labels`). The `customer` must begin with \"C\" (for example, 'C046psxkn').",
// "location": "query",
// "type": "string"
// },
// "view": {
// "description": "The level of detail to be returned. If unspecified, defaults to `View.BASIC`.",
// "enum": [
// "VIEW_UNSPECIFIED",
// "BASIC",
// "FULL"
// ],
// "enumDescriptions": [
// "Default. Should not be used.",
// "Only basic resource information is returned.",
// "All resource information is returned."
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/groups:search",
// "response": {
// "$ref": "SearchGroupsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *GroupsSearchCall) Pages(ctx context.Context, f func(*SearchGroupsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.groups.updateSecuritySettings":
type GroupsUpdateSecuritySettingsCall struct {
s *Service
name string
securitysettings *SecuritySettings
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// UpdateSecuritySettings: Update Security Settings
//
// - name: Output only. The resource name of the security settings.
// Shall be of the form `groups/{group_id}/securitySettings`.
func (r *GroupsService) UpdateSecuritySettings(name string, securitysettings *SecuritySettings) *GroupsUpdateSecuritySettingsCall {
c := &GroupsUpdateSecuritySettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.securitysettings = securitysettings
return c
}
// UpdateMask sets the optional parameter "updateMask": Required. The
// fully-qualified names of fields to update. May only contain the
// following field: `member_restriction.query`.
func (c *GroupsUpdateSecuritySettingsCall) UpdateMask(updateMask string) *GroupsUpdateSecuritySettingsCall {
c.urlParams_.Set("updateMask", updateMask)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsUpdateSecuritySettingsCall) Fields(s ...googleapi.Field) *GroupsUpdateSecuritySettingsCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsUpdateSecuritySettingsCall) Context(ctx context.Context) *GroupsUpdateSecuritySettingsCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsUpdateSecuritySettingsCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsUpdateSecuritySettingsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.securitysettings)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("PATCH", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.updateSecuritySettings" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsUpdateSecuritySettingsCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Update Security Settings",
// "flatPath": "v1/groups/{groupsId}/securitySettings",
// "httpMethod": "PATCH",
// "id": "cloudidentity.groups.updateSecuritySettings",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Output only. The resource name of the security settings. Shall be of the form `groups/{group_id}/securitySettings`.",
// "location": "path",
// "pattern": "^groups/[^/]+/securitySettings$",
// "required": true,
// "type": "string"
// },
// "updateMask": {
// "description": "Required. The fully-qualified names of fields to update. May only contain the following field: `member_restriction.query`.",
// "format": "google-fieldmask",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "request": {
// "$ref": "SecuritySettings"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.checkTransitiveMembership":
type GroupsMembershipsCheckTransitiveMembershipCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// CheckTransitiveMembership: Check a potential member for membership in
// a group. **Note:** This feature is only available to Google Workspace
// Enterprise Standard, Enterprise Plus, and Enterprise for Education;
// and Cloud Identity Premium accounts. If the account of the member is
// not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be
// returned. A member has membership to a group as long as there is a
// single viewable transitive membership between the group and the
// member. The actor must have view permissions to at least one
// transitive membership between the member and group.
//
// - parent: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the group
// to check the transitive membership in. Format: `groups/{group}`,
// where `group` is the unique id assigned to the Group to which the
// Membership belongs to.
func (r *GroupsMembershipsService) CheckTransitiveMembership(parent string) *GroupsMembershipsCheckTransitiveMembershipCall {
c := &GroupsMembershipsCheckTransitiveMembershipCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Query sets the optional parameter "query": Required. A CEL expression
// that MUST include member specification. This is a `required` field.
// Certain groups are uniquely identified by both a 'member_key_id' and
// a 'member_key_namespace', which requires an additional query input:
// 'member_key_namespace'. Example query: `member_key_id ==
// 'member_key_id_value'`
func (c *GroupsMembershipsCheckTransitiveMembershipCall) Query(query string) *GroupsMembershipsCheckTransitiveMembershipCall {
c.urlParams_.Set("query", query)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsCheckTransitiveMembershipCall) Fields(s ...googleapi.Field) *GroupsMembershipsCheckTransitiveMembershipCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsCheckTransitiveMembershipCall) IfNoneMatch(entityTag string) *GroupsMembershipsCheckTransitiveMembershipCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsCheckTransitiveMembershipCall) Context(ctx context.Context) *GroupsMembershipsCheckTransitiveMembershipCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsCheckTransitiveMembershipCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsCheckTransitiveMembershipCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:checkTransitiveMembership")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.checkTransitiveMembership" call.
// Exactly one of *CheckTransitiveMembershipResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *CheckTransitiveMembershipResponse.ServerResponse.Header or
// (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *GroupsMembershipsCheckTransitiveMembershipCall) Do(opts ...googleapi.CallOption) (*CheckTransitiveMembershipResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &CheckTransitiveMembershipResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Check a potential member for membership in a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A member has membership to a group as long as there is a single viewable transitive membership between the group and the member. The actor must have view permissions to at least one transitive membership between the member and group.",
// "flatPath": "v1/groups/{groupsId}/memberships:checkTransitiveMembership",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.checkTransitiveMembership",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "parent": {
// "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the group to check the transitive membership in. Format: `groups/{group}`, where `group` is the unique id assigned to the Group to which the Membership belongs to.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// },
// "query": {
// "description": "Required. A CEL expression that MUST include member specification. This is a `required` field. Certain groups are uniquely identified by both a 'member_key_id' and a 'member_key_namespace', which requires an additional query input: 'member_key_namespace'. Example query: `member_key_id == 'member_key_id_value'`",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships:checkTransitiveMembership",
// "response": {
// "$ref": "CheckTransitiveMembershipResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.create":
type GroupsMembershipsCreateCall struct {
s *Service
parent string
membership *Membership
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a `Membership`.
//
// - parent: The parent `Group` resource under which to create the
// `Membership`. Must be of the form `groups/{group}`.
func (r *GroupsMembershipsService) Create(parent string, membership *Membership) *GroupsMembershipsCreateCall {
c := &GroupsMembershipsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
c.membership = membership
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsCreateCall) Fields(s ...googleapi.Field) *GroupsMembershipsCreateCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsCreateCall) Context(ctx context.Context) *GroupsMembershipsCreateCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.membership)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.create" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsMembershipsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a `Membership`.",
// "flatPath": "v1/groups/{groupsId}/memberships",
// "httpMethod": "POST",
// "id": "cloudidentity.groups.memberships.create",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "parent": {
// "description": "Required. The parent `Group` resource under which to create the `Membership`. Must be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships",
// "request": {
// "$ref": "Membership"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.delete":
type GroupsMembershipsDeleteCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a `Membership`.
//
// - name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Membership` to delete. Must be of the form
// `groups/{group}/memberships/{membership}`.
func (r *GroupsMembershipsService) Delete(name string) *GroupsMembershipsDeleteCall {
c := &GroupsMembershipsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsDeleteCall) Fields(s ...googleapi.Field) *GroupsMembershipsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsDeleteCall) Context(ctx context.Context) *GroupsMembershipsDeleteCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("DELETE", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsMembershipsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Deletes a `Membership`.",
// "flatPath": "v1/groups/{groupsId}/memberships/{membershipsId}",
// "httpMethod": "DELETE",
// "id": "cloudidentity.groups.memberships.delete",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to delete. Must be of the form `groups/{group}/memberships/{membership}`",
// "location": "path",
// "pattern": "^groups/[^/]+/memberships/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.get":
type GroupsMembershipsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves a `Membership`.
//
// - name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Membership` to retrieve. Must be of the form
// `groups/{group}/memberships/{membership}`.
func (r *GroupsMembershipsService) Get(name string) *GroupsMembershipsGetCall {
c := &GroupsMembershipsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsGetCall) Fields(s ...googleapi.Field) *GroupsMembershipsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsGetCall) IfNoneMatch(entityTag string) *GroupsMembershipsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsGetCall) Context(ctx context.Context) *GroupsMembershipsGetCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.get" call.
// Exactly one of *Membership or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Membership.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsMembershipsGetCall) Do(opts ...googleapi.CallOption) (*Membership, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Membership{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a `Membership`.",
// "flatPath": "v1/groups/{groupsId}/memberships/{membershipsId}",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.get",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to retrieve. Must be of the form `groups/{group}/memberships/{membership}`.",
// "location": "path",
// "pattern": "^groups/[^/]+/memberships/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}",
// "response": {
// "$ref": "Membership"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.getMembershipGraph":
type GroupsMembershipsGetMembershipGraphCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// GetMembershipGraph: Get a membership graph of just a member or both a
// member and a group. **Note:** This feature is only available to
// Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise
// for Education; and Cloud Identity Premium accounts. If the account of
// the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status
// code will be returned. Given a member, the response will contain all
// membership paths from the member. Given both a group and a member,
// the response will contain all membership paths between the group and
// the member.
//
// - parent: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the group
// to search transitive memberships in. Format: `groups/{group}`,
// where `group` is the unique ID assigned to the Group to which the
// Membership belongs to. group can be a wildcard collection id "-".
// When a group is specified, the membership graph will be constrained
// to paths between the member (defined in the query) and the parent.
// If a wildcard collection is provided, all membership paths
// connected to the member will be returned.
func (r *GroupsMembershipsService) GetMembershipGraph(parent string) *GroupsMembershipsGetMembershipGraphCall {
c := &GroupsMembershipsGetMembershipGraphCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// Query sets the optional parameter "query": Required. A CEL expression
// that MUST include member specification AND label(s). Certain groups
// are uniquely identified by both a 'member_key_id' and a
// 'member_key_namespace', which requires an additional query input:
// 'member_key_namespace'. Example query: `member_key_id ==
// 'member_key_id_value' && in labels`
func (c *GroupsMembershipsGetMembershipGraphCall) Query(query string) *GroupsMembershipsGetMembershipGraphCall {
c.urlParams_.Set("query", query)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsGetMembershipGraphCall) Fields(s ...googleapi.Field) *GroupsMembershipsGetMembershipGraphCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsGetMembershipGraphCall) IfNoneMatch(entityTag string) *GroupsMembershipsGetMembershipGraphCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsGetMembershipGraphCall) Context(ctx context.Context) *GroupsMembershipsGetMembershipGraphCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsGetMembershipGraphCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsGetMembershipGraphCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:getMembershipGraph")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.getMembershipGraph" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *GroupsMembershipsGetMembershipGraphCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get a membership graph of just a member or both a member and a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. Given a member, the response will contain all membership paths from the member. Given both a group and a member, the response will contain all membership paths between the group and the member.",
// "flatPath": "v1/groups/{groupsId}/memberships:getMembershipGraph",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.getMembershipGraph",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "parent": {
// "description": "Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group to which the Membership belongs to. group can be a wildcard collection id \"-\". When a group is specified, the membership graph will be constrained to paths between the member (defined in the query) and the parent. If a wildcard collection is provided, all membership paths connected to the member will be returned.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// },
// "query": {
// "description": "Required. A CEL expression that MUST include member specification AND label(s). Certain groups are uniquely identified by both a 'member_key_id' and a 'member_key_namespace', which requires an additional query input: 'member_key_namespace'. Example query: `member_key_id == 'member_key_id_value' \u0026\u0026 in labels`",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships:getMembershipGraph",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.list":
type GroupsMembershipsListCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists the `Membership`s within a `Group`.
//
// - parent: The parent `Group` resource under which to lookup the
// `Membership` name. Must be of the form `groups/{group}`.
func (r *GroupsMembershipsService) List(parent string) *GroupsMembershipsListCall {
c := &GroupsMembershipsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// PageSize sets the optional parameter "pageSize": The maximum number
// of results to return. Note that the number of results returned may be
// less than this value even if there are more available results. To
// fetch all results, clients must continue calling this method
// repeatedly until the response no longer contains a `next_page_token`.
// If unspecified, defaults to 200 for `GroupView.BASIC` and to 50 for
// `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC`
// or 500 for `GroupView.FULL`.
func (c *GroupsMembershipsListCall) PageSize(pageSize int64) *GroupsMembershipsListCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// `next_page_token` value returned from a previous search request, if
// any.
func (c *GroupsMembershipsListCall) PageToken(pageToken string) *GroupsMembershipsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// View sets the optional parameter "view": The level of detail to be
// returned. If unspecified, defaults to `View.BASIC`.
//
// Possible values:
//
// "VIEW_UNSPECIFIED" - Default. Should not be used.
// "BASIC" - Only basic resource information is returned.
// "FULL" - All resource information is returned.
func (c *GroupsMembershipsListCall) View(view string) *GroupsMembershipsListCall {
c.urlParams_.Set("view", view)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsListCall) Fields(s ...googleapi.Field) *GroupsMembershipsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsListCall) IfNoneMatch(entityTag string) *GroupsMembershipsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsListCall) Context(ctx context.Context) *GroupsMembershipsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.list" call.
// Exactly one of *ListMembershipsResponse or error will be non-nil. Any
// non-2xx status code is an error. Response headers are in either
// *ListMembershipsResponse.ServerResponse.Header or (if a response was
// returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsMembershipsListCall) Do(opts ...googleapi.CallOption) (*ListMembershipsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ListMembershipsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists the `Membership`s within a `Group`.",
// "flatPath": "v1/groups/{groupsId}/memberships",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.list",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "pageSize": {
// "description": "The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and to 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC` or 500 for `GroupView.FULL`.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The `next_page_token` value returned from a previous search request, if any.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// },
// "view": {
// "description": "The level of detail to be returned. If unspecified, defaults to `View.BASIC`.",
// "enum": [
// "VIEW_UNSPECIFIED",
// "BASIC",
// "FULL"
// ],
// "enumDescriptions": [
// "Default. Should not be used.",
// "Only basic resource information is returned.",
// "All resource information is returned."
// ],
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships",
// "response": {
// "$ref": "ListMembershipsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *GroupsMembershipsListCall) Pages(ctx context.Context, f func(*ListMembershipsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.groups.memberships.lookup":
type GroupsMembershipsLookupCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Lookup: Looks up the resource name
// (https://cloud.google.com/apis/design/resource_names) of a
// `Membership` by its `EntityKey`.
//
// - parent: The parent `Group` resource under which to lookup the
// `Membership` name. Must be of the form `groups/{group}`.
func (r *GroupsMembershipsService) Lookup(parent string) *GroupsMembershipsLookupCall {
c := &GroupsMembershipsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// MemberKeyId sets the optional parameter "memberKey.id": The ID of the
// entity. For Google-managed entities, the `id` should be the email
// address of an existing group or user. For external-identity-mapped
// entities, the `id` must be a string conforming to the Identity
// Source's requirements. Must be unique within a `namespace`.
func (c *GroupsMembershipsLookupCall) MemberKeyId(memberKeyId string) *GroupsMembershipsLookupCall {
c.urlParams_.Set("memberKey.id", memberKeyId)
return c
}
// MemberKeyNamespace sets the optional parameter "memberKey.namespace":
// The namespace in which the entity exists. If not specified, the
// `EntityKey` represents a Google-managed entity such as a Google user
// or a Google Group. If specified, the `EntityKey` represents an
// external-identity-mapped group. The namespace must correspond to an
// identity source created in Admin Console and must be in the form of
// `identitysources/{identity_source}`.
func (c *GroupsMembershipsLookupCall) MemberKeyNamespace(memberKeyNamespace string) *GroupsMembershipsLookupCall {
c.urlParams_.Set("memberKey.namespace", memberKeyNamespace)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsLookupCall) Fields(s ...googleapi.Field) *GroupsMembershipsLookupCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsLookupCall) IfNoneMatch(entityTag string) *GroupsMembershipsLookupCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsLookupCall) Context(ctx context.Context) *GroupsMembershipsLookupCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsLookupCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsLookupCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:lookup")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.lookup" call.
// Exactly one of *LookupMembershipNameResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *LookupMembershipNameResponse.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsMembershipsLookupCall) Do(opts ...googleapi.CallOption) (*LookupMembershipNameResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &LookupMembershipNameResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Membership` by its `EntityKey`.",
// "flatPath": "v1/groups/{groupsId}/memberships:lookup",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.lookup",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "memberKey.id": {
// "description": "The ID of the entity. For Google-managed entities, the `id` should be the email address of an existing group or user. For external-identity-mapped entities, the `id` must be a string conforming to the Identity Source's requirements. Must be unique within a `namespace`.",
// "location": "query",
// "type": "string"
// },
// "memberKey.namespace": {
// "description": "The namespace in which the entity exists. If not specified, the `EntityKey` represents a Google-managed entity such as a Google user or a Google Group. If specified, the `EntityKey` represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of `identitysources/{identity_source}`.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships:lookup",
// "response": {
// "$ref": "LookupMembershipNameResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.modifyMembershipRoles":
type GroupsMembershipsModifyMembershipRolesCall struct {
s *Service
name string
modifymembershiprolesrequest *ModifyMembershipRolesRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// ModifyMembershipRoles: Modifies the `MembershipRole`s of a
// `Membership`.
//
// - name: The resource name
// (https://cloud.google.com/apis/design/resource_names) of the
// `Membership` whose roles are to be modified. Must be of the form
// `groups/{group}/memberships/{membership}`.
func (r *GroupsMembershipsService) ModifyMembershipRoles(name string, modifymembershiprolesrequest *ModifyMembershipRolesRequest) *GroupsMembershipsModifyMembershipRolesCall {
c := &GroupsMembershipsModifyMembershipRolesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.modifymembershiprolesrequest = modifymembershiprolesrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsModifyMembershipRolesCall) Fields(s ...googleapi.Field) *GroupsMembershipsModifyMembershipRolesCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsModifyMembershipRolesCall) Context(ctx context.Context) *GroupsMembershipsModifyMembershipRolesCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsModifyMembershipRolesCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsModifyMembershipRolesCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymembershiprolesrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:modifyMembershipRoles")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.modifyMembershipRoles" call.
// Exactly one of *ModifyMembershipRolesResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *ModifyMembershipRolesResponse.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsMembershipsModifyMembershipRolesCall) Do(opts ...googleapi.CallOption) (*ModifyMembershipRolesResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &ModifyMembershipRolesResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Modifies the `MembershipRole`s of a `Membership`.",
// "flatPath": "v1/groups/{groupsId}/memberships/{membershipsId}:modifyMembershipRoles",
// "httpMethod": "POST",
// "id": "cloudidentity.groups.memberships.modifyMembershipRoles",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` whose roles are to be modified. Must be of the form `groups/{group}/memberships/{membership}`.",
// "location": "path",
// "pattern": "^groups/[^/]+/memberships/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:modifyMembershipRoles",
// "request": {
// "$ref": "ModifyMembershipRolesRequest"
// },
// "response": {
// "$ref": "ModifyMembershipRolesResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudidentity.groups.memberships.searchTransitiveGroups":
type GroupsMembershipsSearchTransitiveGroupsCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// SearchTransitiveGroups: Search transitive groups of a member.
// **Note:** This feature is only available to Google Workspace
// Enterprise Standard, Enterprise Plus, and Enterprise for Education;
// and Cloud Identity Premium accounts. If the account of the member is
// not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be
// returned. A transitive group is any group that has a direct or
// indirect membership to the member. Actor must have view permissions
// all transitive groups.
//
// - parent: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the group
// to search transitive memberships in. Format: `groups/{group}`,
// where `group` is always '-' as this API will search across all
// groups for a given member.
func (r *GroupsMembershipsService) SearchTransitiveGroups(parent string) *GroupsMembershipsSearchTransitiveGroupsCall {
c := &GroupsMembershipsSearchTransitiveGroupsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// PageSize sets the optional parameter "pageSize": The default page
// size is 200 (max 1000).
func (c *GroupsMembershipsSearchTransitiveGroupsCall) PageSize(pageSize int64) *GroupsMembershipsSearchTransitiveGroupsCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// next_page_token value returned from a previous list request, if any.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) PageToken(pageToken string) *GroupsMembershipsSearchTransitiveGroupsCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Query sets the optional parameter "query": Required. A CEL expression
// that MUST include member specification AND label(s). This is a
// `required` field. Users can search on label attributes of groups.
// CONTAINS match ('in') is supported on labels. Identity-mapped groups
// are uniquely identified by both a `member_key_id` and a
// `member_key_namespace`, which requires an additional query input:
// `member_key_namespace`. Example query: `member_key_id ==
// 'member_key_id_value' && in labels`
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Query(query string) *GroupsMembershipsSearchTransitiveGroupsCall {
c.urlParams_.Set("query", query)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Fields(s ...googleapi.Field) *GroupsMembershipsSearchTransitiveGroupsCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) IfNoneMatch(entityTag string) *GroupsMembershipsSearchTransitiveGroupsCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Context(ctx context.Context) *GroupsMembershipsSearchTransitiveGroupsCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsSearchTransitiveGroupsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:searchTransitiveGroups")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.searchTransitiveGroups" call.
// Exactly one of *SearchTransitiveGroupsResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *SearchTransitiveGroupsResponse.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Do(opts ...googleapi.CallOption) (*SearchTransitiveGroupsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &SearchTransitiveGroupsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Search transitive groups of a member. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive group is any group that has a direct or indirect membership to the member. Actor must have view permissions all transitive groups.",
// "flatPath": "v1/groups/{groupsId}/memberships:searchTransitiveGroups",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.searchTransitiveGroups",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "pageSize": {
// "description": "The default page size is 200 (max 1000).",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The next_page_token value returned from a previous list request, if any.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is always '-' as this API will search across all groups for a given member.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// },
// "query": {
// "description": "Required. A CEL expression that MUST include member specification AND label(s). This is a `required` field. Users can search on label attributes of groups. CONTAINS match ('in') is supported on labels. Identity-mapped groups are uniquely identified by both a `member_key_id` and a `member_key_namespace`, which requires an additional query input: `member_key_namespace`. Example query: `member_key_id == 'member_key_id_value' \u0026\u0026 in labels`",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships:searchTransitiveGroups",
// "response": {
// "$ref": "SearchTransitiveGroupsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *GroupsMembershipsSearchTransitiveGroupsCall) Pages(ctx context.Context, f func(*SearchTransitiveGroupsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "cloudidentity.groups.memberships.searchTransitiveMemberships":
type GroupsMembershipsSearchTransitiveMembershipsCall struct {
s *Service
parent string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// SearchTransitiveMemberships: Search transitive memberships of a
// group. **Note:** This feature is only available to Google Workspace
// Enterprise Standard, Enterprise Plus, and Enterprise for Education;
// and Cloud Identity Premium accounts. If the account of the group is
// not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be
// returned. A transitive membership is any direct or indirect
// membership of a group. Actor must have view permissions to all
// transitive memberships.
//
// - parent: Resource name
// (https://cloud.google.com/apis/design/resource_names) of the group
// to search transitive memberships in. Format: `groups/{group}`,
// where `group` is the unique ID assigned to the Group.
func (r *GroupsMembershipsService) SearchTransitiveMemberships(parent string) *GroupsMembershipsSearchTransitiveMembershipsCall {
c := &GroupsMembershipsSearchTransitiveMembershipsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.parent = parent
return c
}
// PageSize sets the optional parameter "pageSize": The default page
// size is 200 (max 1000).
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) PageSize(pageSize int64) *GroupsMembershipsSearchTransitiveMembershipsCall {
c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
return c
}
// PageToken sets the optional parameter "pageToken": The
// next_page_token value returned from a previous list request, if any.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) PageToken(pageToken string) *GroupsMembershipsSearchTransitiveMembershipsCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) Fields(s ...googleapi.Field) *GroupsMembershipsSearchTransitiveMembershipsCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) IfNoneMatch(entityTag string) *GroupsMembershipsSearchTransitiveMembershipsCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) Context(ctx context.Context) *GroupsMembershipsSearchTransitiveMembershipsCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:searchTransitiveMemberships")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"parent": c.parent,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudidentity.groups.memberships.searchTransitiveMemberships" call.
// Exactly one of *SearchTransitiveMembershipsResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *SearchTransitiveMembershipsResponse.ServerResponse.Header or
// (if a response was returned at all) in
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
// whether the returned error was because http.StatusNotModified was
// returned.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) Do(opts ...googleapi.CallOption) (*SearchTransitiveMembershipsResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, gensupport.WrapError(&googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
})
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, gensupport.WrapError(err)
}
ret := &SearchTransitiveMembershipsResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Search transitive memberships of a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the group is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive membership is any direct or indirect membership of a group. Actor must have view permissions to all transitive memberships.",
// "flatPath": "v1/groups/{groupsId}/memberships:searchTransitiveMemberships",
// "httpMethod": "GET",
// "id": "cloudidentity.groups.memberships.searchTransitiveMemberships",
// "parameterOrder": [
// "parent"
// ],
// "parameters": {
// "pageSize": {
// "description": "The default page size is 200 (max 1000).",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The next_page_token value returned from a previous list request, if any.",
// "location": "query",
// "type": "string"
// },
// "parent": {
// "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group.",
// "location": "path",
// "pattern": "^groups/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+parent}/memberships:searchTransitiveMemberships",
// "response": {
// "$ref": "SearchTransitiveMembershipsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-identity.groups",
// "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *GroupsMembershipsSearchTransitiveMembershipsCall) Pages(ctx context.Context, f func(*SearchTransitiveMembershipsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
| {
"content_hash": "345b616320da1666b992375ff21e8db6",
"timestamp": "",
"source": "github",
"line_count": 9952,
"max_line_length": 999,
"avg_line_length": 39.77471864951769,
"alnum_prop": 0.7140800024252346,
"repo_name": "google/google-api-go-client",
"id": "e58ca6bebdaeea459e3fe08417c9362c976908b1",
"size": "397504",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "cloudidentity/v1/cloudidentity-gen.go",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Go",
"bytes": "611768"
},
{
"name": "Makefile",
"bytes": "1232"
},
{
"name": "Shell",
"bytes": "13231"
}
],
"symlink_target": ""
} |
<?php
/* TwigBundle:Exception:error.js.twig */
class __TwigTemplate_5b8ad47caea4a6b1ca300bd82e64a15a0164e9b19d912dba466563f9c4667a76 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "/*
";
// line 2
echo twig_escape_filter($this->env, (isset($context["status_code"]) ? $context["status_code"] : null), "js", null, true);
echo " ";
echo twig_escape_filter($this->env, (isset($context["status_text"]) ? $context["status_text"] : null), "js", null, true);
echo "
*/
";
}
public function getTemplateName()
{
return "TwigBundle:Exception:error.js.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 22 => 2, 19 => 1,);
}
}
| {
"content_hash": "d5280933cad1dcb7780da2078a278df1",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 129,
"avg_line_length": 23.244444444444444,
"alnum_prop": 0.5755258126195029,
"repo_name": "xbantcl/SymfonyProject",
"id": "579483693b070079f8435c7872982d6e0137d7e6",
"size": "1046",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/cache/prod/twig/5b/8a/d47caea4a6b1ca300bd82e64a15a0164e9b19d912dba466563f9c4667a76.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11907"
},
{
"name": "PHP",
"bytes": "88774"
}
],
"symlink_target": ""
} |
.. _developer_guide:
Developer Guide
===============
.. toctree::
:maxdepth: 2
architecture.rst
api.rst | {
"content_hash": "309ae4ccba1bd6dcbaaa4ccee7444b5b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 20,
"avg_line_length": 10.545454545454545,
"alnum_prop": 0.5603448275862069,
"repo_name": "bsipocz/glue",
"id": "e8872a6632a2675bd5a1a698b313c32d9cb4e8a3",
"size": "116",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/developer_guide.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.apache.batik.ext.awt.g2d;
import java.awt.geom.AffineTransform;
/**
* Contains a description of an elementary transform stack element,
* such as a rotate or translate. A transform stack element has a
* type and a value, which is an array of double values.<br>
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
* @author <a href="mailto:paul_evenblij@compuware.com">Paul Evenblij</a>
* @version $Id$
*/
public abstract class TransformStackElement implements Cloneable{
/**
* Transform type
*/
private TransformType type;
/**
* Value
*/
private double[] transformParameters;
/**
* @param type transform type
* @param transformParameters parameters for transform
*/
protected TransformStackElement(TransformType type,
double[] transformParameters){
this.type = type;
this.transformParameters = transformParameters;
}
/**
* @return an object which is a deep copy of this one
*/
public Object clone() {
TransformStackElement newElement = null;
// start with a shallow copy to get our implementations right
try {
newElement = (TransformStackElement) super.clone();
} catch(java.lang.CloneNotSupportedException ex) {}
// now deep copy the parameter array
double[] transformParameters = new double[this.transformParameters.length];
System.arraycopy(this.transformParameters, 0, transformParameters, 0, transformParameters.length);
newElement.transformParameters = transformParameters;
return newElement;
}
/*
* Factory methods
*/
public static TransformStackElement createTranslateElement(double tx,
double ty){
return new TransformStackElement(TransformType.TRANSLATE,
new double[]{ tx, ty }) {
boolean isIdentity(double[] parameters) {
return parameters[0] == 0 && parameters[1] == 0;
}
};
}
public static TransformStackElement createRotateElement(double theta){
return new TransformStackElement(TransformType.ROTATE,
new double[]{ theta }) {
boolean isIdentity(double[] parameters) {
return Math.cos(parameters[0]) == 1;
}
};
}
public static TransformStackElement createScaleElement(double scaleX,
double scaleY){
return new TransformStackElement(TransformType.SCALE,
new double[]{ scaleX, scaleY }) {
boolean isIdentity(double[] parameters) {
return parameters[0] == 1 && parameters[1] == 1;
}
};
}
public static TransformStackElement createShearElement(double shearX,
double shearY){
return new TransformStackElement(TransformType.SHEAR,
new double[]{ shearX, shearY }) {
boolean isIdentity(double[] parameters) {
return parameters[0] == 0 && parameters[1] == 0;
}
};
}
public static TransformStackElement createGeneralTransformElement
(AffineTransform txf){
double[] matrix = new double[6];
txf.getMatrix(matrix);
return new TransformStackElement(TransformType.GENERAL, matrix) {
boolean isIdentity(double[] m) {
return (m[0] == 1 && m[2] == 0 && m[4] == 0 &&
m[1] == 0 && m[3] == 1 && m[5] == 0);
}
};
}
/**
* Implementation should determine if the parameter list represents
* an identity transform, for the instance transform type.
*/
abstract boolean isIdentity(double[] parameters);
/**
* @return true iff this transform is the identity transform
*/
public boolean isIdentity() {
return isIdentity(transformParameters);
}
/**
* @return array of values containing this transform element's parameters
*/
public double[] getTransformParameters(){
return transformParameters;
}
/**
* @return this transform type
*/
public TransformType getType(){
return type;
}
/*
* Concatenation utility. Requests this transform stack element
* to concatenate with the input stack element. Only elements
* of the same types are concatenated. For example, if this
* element represents a translation, it will concatenate with
* another translation, but not with any other kind of
* stack element.
* @param stackElement element to be concatenated with this one.
* @return true if the input stackElement was concatenated with
* this one. False otherwise.
*/
public boolean concatenate(TransformStackElement stackElement){
boolean canConcatenate = false;
if(type.toInt() == stackElement.type.toInt()){
canConcatenate = true;
switch(type.toInt()){
case TransformType.TRANSFORM_TRANSLATE:
transformParameters[0] += stackElement.transformParameters[0];
transformParameters[1] += stackElement.transformParameters[1];
break;
case TransformType.TRANSFORM_ROTATE:
transformParameters[0] += stackElement.transformParameters[0];
break;
case TransformType.TRANSFORM_SCALE:
transformParameters[0] *= stackElement.transformParameters[0];
transformParameters[1] *= stackElement.transformParameters[1];
break;
case TransformType.TRANSFORM_GENERAL:
transformParameters
= matrixMultiply(transformParameters,
stackElement.transformParameters);
break;
default:
canConcatenate = false;
}
}
return canConcatenate;
}
/**
* Multiplies two 2x3 matrices of double precision values
*/
private double[] matrixMultiply(double[] matrix1, double[] matrix2) {
double[] product = new double[6];
AffineTransform transform1 = new AffineTransform(matrix1);
transform1.concatenate(new AffineTransform(matrix2));
transform1.getMatrix(product);
return product;
}
}
| {
"content_hash": "8ed284a068f9c8945338e6df16c7735f",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 106,
"avg_line_length": 35.51322751322751,
"alnum_prop": 0.5807508939213349,
"repo_name": "apache/batik",
"id": "1c5aef82ca0210feab5877fa1a558b2a95537490",
"size": "7511",
"binary": false,
"copies": "4",
"ref": "refs/heads/trunk",
"path": "batik-awt-util/src/main/java/org/apache/batik/ext/awt/g2d/TransformStackElement.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7179"
},
{
"name": "CSS",
"bytes": "3937"
},
{
"name": "HTML",
"bytes": "21130"
},
{
"name": "Java",
"bytes": "12228790"
},
{
"name": "JavaScript",
"bytes": "16619"
},
{
"name": "Makefile",
"bytes": "278"
},
{
"name": "Shell",
"bytes": "6155"
},
{
"name": "XSLT",
"bytes": "40501"
}
],
"symlink_target": ""
} |
module BLE
# Adapter class
# Adapter.list
# a = Adapter.new('hci0')
# a.start_discover ; sleep(10) ; a.stop_discovery
# a.devices
#
class Adapter
# Return a list of available unix device name for the
# adapter installed on the system.
# @return [Array<String>] list of unix device name
def self.list
o_bluez = BLUEZ.object('/org/bluez')
o_bluez.introspect
o_bluez.subnodes.reject {|adapter| ['test'].include?(adapter) }
end
# Create a new Adapter
#
# @param iface [String] name of the Unix device
def initialize(iface)
@iface = iface.dup.freeze
@o_adapter = BLUEZ.object("/org/bluez/#{@iface}")
@o_adapter.introspect
# @o_adapter[I_PROPERTIES]
# .on_signal('PropertiesChanged') do |intf, props|
# end
# end
end
# The Bluetooth interface name
# @return [String] name of the Unix device
def iface
@iface
end
# The Bluetooth device address.
# @return [String] MAC address of the adapter
def address
@o_adapter[I_ADAPTER]['Address']
end
# The Bluetooth system name (pretty hostname).
# @return [String]
def name
@o_adapter[I_ADAPTER]['Name']
end
# The Bluetooth friendly name.
# In case no alias is set, it will return the system provided name.
# @return [String]
def alias
@o_adapter[I_ADAPTER]['Alias']
end
# Set the alias name.
#
# When resetting the alias with an empty string, the
# property will default back to system name
#
# @param val [String] new alias name.
# @return [void]
def alias=(val)
@o_adapter[I_ADAPTER]['Alias'] = val.nil? ? '' : val.to_str
nil
end
# Return the device corresponding to the given address.
# @note The device object returned has a dependency on the adapter.
#
# @param address MAC address of the device
# @return [Device] a device
def [](address)
Device.new(@iface, address)
end
# This method sets the device discovery filter for the caller.
# When this method is called with +nil+ or an empty list of UUIDs,
# filter is removed.
#
# @todo Need to sync with the adapter-api.txt
#
# @param uuids a list of uuid to filter on
# @param rssi RSSI threshold
# @param pathloss pathloss threshold
# @param transport [:auto, :bredr, :le]
# type of scan to run (default: :le)
# @return [self]
def filter(uuids, rssi: nil, pathloss: nil, transport: :le)
unless [:auto, :bredr, :le].include?(transport)
raise ArgumentError,
"transport must be one of :auto, :bredr, :le"
end
filter = { }
unless uuids.nil? || uuids.empty?
filter['UUIDs' ] = DBus.variant('as', uuids)
end
unless rssi.nil?
filter['RSSI' ] = DBus.variant('n', rssi)
end
unless pathloss.nil?
filter['Pathloss' ] = DBus.variant('q', pathloss)
end
unless transport.nil?
filter['Transport'] = DBus.variant('s', transport.to_s)
end
@o_adapter[I_ADAPTER].SetDiscoveryFilter(filter)
self
end
# Starts the device discovery session.
# This includes an inquiry procedure and remote device name resolving.
# Use {#stop_discovery} to release the sessions acquired.
# This process will start creating device in the underlying api
# as new devices are discovered.
#
# @return [Boolean]
def start_discovery
@o_adapter[I_ADAPTER].StartDiscovery
true
rescue DBus::Error => e
case e.name
when E_IN_PROGRESS then true
when E_FAILED then false
else raise ScriptError
end
end
# This method will cancel any previous {#start_discovery}
# transaction.
# @note The discovery procedure is shared
# between all discovery sessions thus calling {#stop_discovery}
# will only release a single session.
#
# @return [Boolean]
def stop_discovery
@o_adapter[I_ADAPTER].StopDiscovery
true
rescue DBus::Error => e
case e.name
when E_FAILED then false
when E_NOT_READY then false
when E_NOT_AUTHORIZED then raise NotAuthorized
else raise ScriptError
end
end
# List of devices MAC address that have been discovered.
#
# @return [Array<String>] List of devices MAC address.
def devices
@o_adapter.introspect # Force refresh
@o_adapter.subnodes.map {|dev| # Format: dev_aa_bb_cc_dd_ee_ff
dev[4..-1].tr('_', ':') }
end
end
end
| {
"content_hash": "69d545f16ca4433cf2c5d9cc869f087c",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 74,
"avg_line_length": 29.882716049382715,
"alnum_prop": 0.5860359429869861,
"repo_name": "sdalu/ruby-ble",
"id": "1ceb17aee88cd14cdf29b0504296060cfcd49040",
"size": "4841",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/ble/adapter.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "54010"
}
],
"symlink_target": ""
} |
Repository for ISTE 422 -- Application Development Practices
##Exercise 3
For this exercise, you will need to accommplish the following tasks
1. Clone this repository
2. Checkout the Excercise 3 branch
* you will notice 3 directories, _src_, _cvsroot_, and _svnrepo_
* the _src_ directory contains the Java source code for this exercise
* the _cvsroot_ directory contains an empty CVS root repository (the output of _cvs init -d cvsroot_)
* the _svnrepo_ directory contains an empty Subverison repository
3. Your job is to add the src directory as projects within the CVS and Subversion repositories.
4. Then, modify the Java source file to change the "Hello World" print to instead print out your name.
5. Update each repository with your changes, so that they show up as a commit
* If I run _cvs log_ I should see your commit history
* If I run _svn log_ I should see your commit
* If I run _git log_ I should see your commit
6. Submit a zip or tar of your entire git project. | {
"content_hash": "823e5db69e9766d73399619cf2e1c30b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 102,
"avg_line_length": 54.833333333333336,
"alnum_prop": 0.7629179331306991,
"repo_name": "Elitecuervo/iste422-exercise3",
"id": "f85715a9b2f0c501fe0d8c8bd818dfc7399db7e3",
"size": "997",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "133"
},
{
"name": "Shell",
"bytes": "21145"
}
],
"symlink_target": ""
} |
DEM to STL
==========
This repository contains Python scripts for converting the CDED flavour of DEM (Digital Elevation Model) files to 2D Bitmaps and 3D STL files. CDED stands for Canadian Digital Elevation Model, and is generally used to describe topographical surveys of various regions within Canada. Example: [CDED Model of the Greater Toronto Area](http://geogratis.gc.ca/api/en/nrcan-rncan/ess-sst/d09e4699-94da-4e6d-bf65-4f3a55393606.html)
STL files are commonly used for 3D printing. The resulting STL files from this script should be fully 3D-printable.
## Basic Usage
These scripts were written and tested in Python 2.7.
Reading the DEM Metadata:
```
python dump_dem_metadata.py sourcefile.dem
```
Converting the DEM to a Bitmap:
```
python dem_to_bmp.py sourcefile.dem destinationfile.bmp [-c] [-q INT]
```
* The `-c` flag will output blue-green instead of greyscale.
* The `-q` represents "quality". 1 will match the source resolution, while higher numbers will reduce the resolution.
Converting the DEM to an STL:
```
python dem_to_stl.py sourcefile.dem destinationfile.stl [-q INT]
```
* The `-q` represents "quality". 1 will match the source resolution, while higher numbers will reduce the resolution.
## Advanced Usage
The module `cdedtools.demparser` currently offers two functions:
```python
from cdedtools import demparser
with open('filename.dem', 'r') as f:
# read_metadata(f) will parse the headers of a DEM file
# and return a dictionary of metadata entries. Integers
# that represent string values in the CDED spec will be
# translated to a readable string where appropriate,
# eg. uomGround: 1 -> uomGround: "Meters".
# See cdedtools.translationtables to view all translations.
metadata = demparser.read_metadata(f)
# read_data(f) will parse the elevation data from a DEM
# file and return a two-dimensional array of integers.
# Typically, -32767 is considered a void value, while all
# other values are distances above (+) or below (-) sea level.
elevations = demparser.read_data(f)
```
The module `stltools.stlgenerator` offers a single function:
```python
from stltools import stlgenerator
heightmap = [
[10, 10, 10], # y
[10, 40, 10], # y
[10, 10, 10] # y
# x, x, x
]
# Given a two-dimensional array of integers, this function
# will write a binary STL to the specified destination
# file. Under most circumstances, the model should be solid
# and manifold; ready for 3D printing. The heightmap is applied
# to the top facets only, while the bottom and sides will be flat.
# The distance between each point on the x and y axis will be 1mm.
# the elevation values will be interpreted in millimeters with
# values less than 1 being rounded up to 1mm.
stlgenerator.generate_from_heightmap_array(heightmap, 'destination.stl')
```
| {
"content_hash": "b7374959ab7086ef19b740f59b4c1045",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 425,
"avg_line_length": 39.563380281690144,
"alnum_prop": 0.7461730153079388,
"repo_name": "IdeaShakerLab/dem-to-stl",
"id": "f7560ec41a2bdee45697a3c5dbf139cf21de5ce6",
"size": "2809",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "18971"
}
],
"symlink_target": ""
} |
<?php
class MySQL
{
private static $link;
//
public static function connect($user, $password, $host, $schema)
{
self::$link = new mysqli($host, $user, $password, $schema);
/*
if(!self::$connection)
{
die('Database disaster!');
}
*/
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
//VERY important for MySQL UTF-8 databases!
self::$link->query('SET NAMES utf8');
//self::$link->query('SET CHARACTER SET utf8');
//set the default fetchmode
//$this->connection->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
//
public static function close()
{
self::$link->close();
}
//
private static function handleError($sql)
{
//echo '<xmp>' . VAR_DUMP($result) . '</xmp>';
//echo '<xmp>' . VAR_DUMP(getmethods($result)) . '</xmp>';
//Reflection::export(new ReflectionClass('MDB2_Error'));
if($_SERVER['HTTP_HOST'] != 'www.gaijinavi.com')
{
echo '<div style="font-weight:bold; white-space:pre; border:1px dashed red;"><span style="color:blue;">' . $sql . '</span><br/>gave an error of: <span style="color:red;">' . self::$link->error . '</span></div>';
}
//exit;
}
//----MDB2-like interface methods--------
//
public static function query($sql) //Return resultset object
{
$result = self::$link->query($sql);
if(!$result)
{
self::handleError($sql);
}
return $result;
}
//
public static function queryOne($sql) //Return single data item
{
$sql = $sql . ' LIMIT 0,1';
$result = self::$link->query($sql);
if(!$result)
{
self::handleError($sql);
}
$row = $result->fetch_row();
$result->close();
return $row[0];
}
//
public static function queryRow($sql) //Return one row as an assoc array
{
$sql = $sql . ' LIMIT 0,1';
$result = self::$link->query($sql);
if(!$result)
{
self::handleError($sql);
}
$row = $result->fetch_assoc();
$result->close();
return $row;
}
//
public static function queryAll($sql) //Return *all* rows as an array of assoc arrays
{
$result = self::$link->query($sql, MYSQLI_USE_RESULT);
if(!$result)
{
self::handleError($sql);
}
$all_rows = array();
while(!is_null($row = $result->fetch_assoc()))
{
$all_rows[] = $row;
}
$result->close();
return $all_rows;
}
public static function queryCol($sql) //Return first column of results table
{
$tempResults = self::$link->query($sql);
if(!$tempResults)
{
self::handleError($sql);
}
$column = array();
while(!is_null($row = $tempResults->fetch_row()))
{
$column[] = $row[0];
}
$tempResults->close();
//return $tempResults->fetchCol();
return $column;
}
//
public static function exec($sql)
{
$result = self::$link->query($sql);
if(!$result)
{
self::handleError($sql);
}
return $result;
}
public static function lastInsertId()
{
return mysqli_insert_id(self::$link);
//SELECT LAST_INSERT_ID()
}
//----Utility methods--------
public static function esc($string)
{
return mysqli_real_escape_string(self::$link, $string);
}
}
//Database connectivity
define('DB_USER', 'blah');
define('DB_PASS', 'blah');
define('DB_HOST', 'localhost');
define('DB_SCHEMA', 'mapanese_mapanese');
MySQL::connect(DB_USER, DB_PASS, DB_HOST, DB_SCHEMA);
set_time_limit(0);
$lines = file($_REQUEST['filename']);
foreach($lines as $line)
{
$line = trim($line); //Kill newline for what it's worth...
MySQL::exec($line);
} | {
"content_hash": "2b224b6c77569537a7d9c5c7f99e9c7a",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 214,
"avg_line_length": 17.480392156862745,
"alnum_prop": 0.588334268087493,
"repo_name": "danielrhodeswarp/Mapanese",
"id": "69b42fcf7cd5032459bd2d4e7c1ac7e65473e941",
"size": "3566",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/ultimatesqleater.php",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "41022"
},
{
"name": "PHP",
"bytes": "166869"
}
],
"symlink_target": ""
} |
package nz.strydom.gross;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@ActiveProfiles("test")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = GrossApplication.class)
@WebAppConfiguration
public class GrossApplicationTests {
@Test
public void contextLoads() {
fail("Not implemented");
}
}
| {
"content_hash": "3c18f57d6e99dde7705c2bb099c81559",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 27.956521739130434,
"alnum_prop": 0.8304821150855366,
"repo_name": "STRiDGE/gross-re",
"id": "8f17413974b2ec483b7696da73827bd775b53fbf",
"size": "643",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/nz/strydom/gross/GrossApplicationTests.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "6128"
},
{
"name": "Java",
"bytes": "27665"
},
{
"name": "JavaScript",
"bytes": "3364"
}
],
"symlink_target": ""
} |
import './developer-bar.scss'
/**
* Component Definition
*
* @export
* @class AngularLogo
* @implements {ng.IComponentOptions}
*/
export class DeveloperBar implements ng.IComponentOptions {
/**
* Controller used with Component
*
* @type {Function}
*/
public controller: Function = DeveloperBarController
/**
* Template used with Component
*
* @type {string}
*/
public template: string = require('./developer-bar.html').toString()
/**
* Object containing pairs Directive Bindings for Component
*
* @type {Object}
*/
public bindings: { [binding: string]: string; } = {}
}
/**
* DeveloperBar - Controller
*
* @export
* @class AngularLogoController
*/
class DeveloperBarController {
/**
* $inject to make angular DI minifiication safe
*
* @static
* @type {Array<string>}
*/
public static $inject: Array<string> = ['$log']
/**
* List of Developer Helper Links
*
* @private
* @type {Array<object>}
*/
public links: [any]
/**
* @param {*} $log Angular Log Service
*/
constructor(public $log: any) {
this.$log = $log.getInstance('developerBar', false)
this.$log.debug('constructor')
}
/**
* life cycle hook (road to ng2)
*/
public $onInit(): void {
this.$log.debug('onInit')
// links to render in the bar
this.links = [
{ path: 'docs/typedoc/index.html', title: 'TypeDoc' },
{ path: 'docs/sassdoc/index.html', title: 'SassDoc' },
{ path: 'docs/coverage/index.html', title: 'Code Coverage' },
{ path: 'https://material.angularjs.org/latest/', title: 'Angular Material' },
{ path: 'https://design.google.com/icons/', title: 'Material Icons' },
]
}
}
| {
"content_hash": "a0ae6400fbbba0e0b28fa8d2cff694d9",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 84,
"avg_line_length": 21.073170731707318,
"alnum_prop": 0.609375,
"repo_name": "andrew-hamilton-dev/angular-1.5-typescript-seed",
"id": "18a910322ce61dc679e7d96a0927b57cc13c25c8",
"size": "1728",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/common/components/developer-bar/developer-bar.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1783"
},
{
"name": "HTML",
"bytes": "2754"
},
{
"name": "JavaScript",
"bytes": "14860"
},
{
"name": "TypeScript",
"bytes": "43804"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hammer-tactics: Not compatible</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0 / hammer-tactics - 1.2.1+8.11</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
hammer-tactics
<small>
1.2.1+8.11
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-06-25 03:38:52 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-06-25 03:38:52 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.12 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
coq 8.5.0 Formal proof management system.
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/lukaszcz/coqhammer"
dev-repo: "git+https://github.com/lukaszcz/coqhammer.git"
bug-reports: "https://github.com/lukaszcz/coqhammer/issues"
license: "LGPL-2.1-only"
synopsis: "Reconstruction tactics for the hammer for Coq"
description: """
Collection of tactics that are used by the hammer for Coq
to reconstruct proofs found by automated theorem provers. When the hammer
has been successfully applied to a project, only this package needs
to be installed; the hammer plugin is not required.
"""
build: [make "-j%{jobs}%" {ocaml:version >= "4.06.1"} "tactics"]
install: [
[make "install-tactics"]
[make "test-tactics"] {with-test}
]
depends: [
"ocaml"
"coq" {>= "8.11" & < "8.12~"}
]
conflicts: [
"coq-hammer" {!= version}
]
tags: [
"keyword:automation"
"keyword:hammer"
"keyword:tactics"
"logpath:Hammer.Tactics"
"date:2020-06-05"
]
authors: [
"Lukasz Czajka <lukaszcz@mimuw.edu.pl>"
]
url {
src: "https://github.com/lukaszcz/coqhammer/archive/v1.2.1-coq8.11.tar.gz"
checksum: "sha512=7ef5f5e68cc2645ef093dc63d1531cc9696afeabdd540b24c6955fa994417b85925c15856e56cfb41eea9424278cf3ee2fd899f9c84f04d8f8630165b188b666"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-hammer-tactics.1.2.1+8.11 coq.8.5.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0).
The following dependencies couldn't be met:
- coq-hammer-tactics -> coq >= 8.11
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-hammer-tactics.1.2.1+8.11</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "de78ffca6d054066364a7f1376bee3ac",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 159,
"avg_line_length": 40.24022346368715,
"alnum_prop": 0.5558794946550049,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "4a123e80d21d4774183849f1d23df65079a7457a",
"size": "7205",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.6/released/8.5.0/hammer-tactics/1.2.1+8.11.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
void add_tests_track_cache(void);
void add_test_track_cache(const char *test_name, void (*test)(sem_track_cache* track_cache, const void* data));
void test_track_cache_setup(sem_track_cache* track_cache, const void* data);
void test_track_cache_teardown(sem_track_cache* track_cache, const void* data);
#endif
| {
"content_hash": "081ddb6ba3dd1b17f86f412cf43a915d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 111,
"avg_line_length": 39.125,
"alnum_prop": 0.7476038338658147,
"repo_name": "hertzsprung/semaphore",
"id": "a2693fe18ab71dc4ea90514eacf6f331b7f3c5c2",
"size": "406",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/test_track_cache.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "243016"
},
{
"name": "Makefile",
"bytes": "1748"
}
],
"symlink_target": ""
} |
@interface GroupKVORefreshView : UIView
@property (nonatomic, copy) void(^didTriggerRefreshBlock)(void);
@property (nonatomic, copy) BOOL(^canRefresh)(void);
+ (instancetype)refreshView;
- (void)endRefresh;
- (void)beginRefresh;
@end
| {
"content_hash": "636590f3343487da0ed5d84e215bafbf",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 33.42857142857143,
"alnum_prop": 0.7692307692307693,
"repo_name": "hellochenms/MHelloListUI",
"id": "ca5473129a5739b5dbb1db7be9b6f7660854382b",
"size": "411",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MHelloListUI/Sources/RefreshLoadMore/GroupKVORefreshView.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "170329"
}
],
"symlink_target": ""
} |
require 'rspec-puppet'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
$: << File.join(fixture_path, 'modules/module-data/lib')
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.hiera_config = File.join(fixture_path, 'hiera/hiera.yaml')
end
def default_test_facts
{
:boxen_home => "/test/boxen",
:boxen_user => "testuser",
:boxen_s3_host => "s3.amazonaws.com",
:boxen_s3_bucket => "boxen-downloads",
:macosx_productversion_major => "10.8",
:osfamily => "Darwin",
}
end
| {
"content_hash": "a216697629b50d8c900ae895d6949406",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 31.318181818181817,
"alnum_prop": 0.5732946298984035,
"repo_name": "exedre/my-boxen",
"id": "e2f60938eb3752e834e7993284a7ac2e4d29cf74",
"size": "689",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "modules/ruby/spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Puppet",
"bytes": "30236"
},
{
"name": "Ruby",
"bytes": "11289"
},
{
"name": "Shell",
"bytes": "1280"
}
],
"symlink_target": ""
} |
//
namespace Demo.Library.Algorithms.Cardinality
{
/// <summary>
/// Estimator for the number of unique elements in a set
/// </summary>
/// <typeparam name="T">The type of elements in the set</typeparam>
public interface ICardinalityEstimator<in T>
{
/// <summary>
/// Adds an element to the counted set. Elements added multiple times will be counted only once.
/// </summary>
/// <param name="element">The element to add</param>
void Add(T element);
/// <summary>
/// Returns the estimated number of unique elements in the counted set
/// </summary>
/// <returns>The estimated count of unique elements</returns>
ulong Count();
/// <summary>
/// Gets the number of times elements were added (including duplicates)
/// </summary>
/// <returns>The number of times <see cref="Add"/> was called</returns>
ulong CountAdditions { get; }
}
} | {
"content_hash": "f3eb19861267cc1a9fd9d59ae6e55784",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 109,
"avg_line_length": 34.6551724137931,
"alnum_prop": 0.5900497512437811,
"repo_name": "volak/DDD.Enterprise.Example",
"id": "7307289ca80096bb47230d243818ca364cda0b29",
"size": "2287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Infrastructure/Library/Algorithms/Cardinality/ICardinalityEstimator.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "228"
},
{
"name": "C#",
"bytes": "926559"
}
],
"symlink_target": ""
} |
"use strict";
var config = require( "#redis" );
var redis = require( "redis" );
var client = redis.createClient( config.port, config.host, config.options );
var urlparser = require( ":urlParser" );
client.on( "error", function( err ) {
console.log( "Redis Error:" );
console.log( err );
} );
var cache = {
url2key: function( _url ) {
var url = urlparser.parse( _url );
if ( url === false ) {
return false;
}
if ( url.protocol === null || url.path === null || url.hostname === null ) {
return false;
}
return ( ( config.protocol ) ? url.protocol + "://" : "" ) + url.hostname + url.path;
},
get: function( url, cb ) {
var key = cache.url2key( url );
if ( key === false ) {
return cb( config.error );
}
client.get( config.prefix + key, function( err, value ) {
if ( err ) {
return cb( err );
}
return cb( null, value );
} );
},
set: function( url, value, ttl, cb ) {
var key = cache.url2key( url );
if ( key === false ) {
return ( cb ) ? cb( config.error ) : false;
}
client.set( config.prefix + key, value, function( err, result ) {
if ( err ) {
return ( cb ) ? cb( err ) : false;
}
if ( value === 0 ) {
client.expire( config.prefix + key, ( ttl || config.expire.ko ) ); // In seconds
} else {
client.expire( config.prefix + key, ( ttl || config.expire.ok ) ); // In seconds
}
return ( cb ) ? cb( null, result ) : true;
} );
},
del: function( url, cb ) {
var key = cache.url2key( url );
if ( key === false ) {
return ( cb ) ? cb( config.error ) : false;
}
client.keys( config.prefix + key + "*", function( err, keys ) {
if ( err ) {
return ( cb ) ? cb( err ) : false;
}
keys.forEach( function( key ) {
client.del( key );
} );
return ( cb ) ? cb( null, keys ) : true;
} );
}
};
module.exports = cache;
| {
"content_hash": "61d339dba3c142b5bb220f9013ab246b",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 87,
"avg_line_length": 26.257142857142856,
"alnum_prop": 0.5484221980413493,
"repo_name": "creative-area/cache-url-interface",
"id": "9dd757cd9ff40b77fee564c59d1bbb7ba42fe730",
"size": "1838",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/cache/redis/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "892"
}
],
"symlink_target": ""
} |
import { CurrencyShekel24 } from "../../";
export = CurrencyShekel24;
| {
"content_hash": "48887b7972e65e65fa5f2419aa753200",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 42,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.676056338028169,
"repo_name": "markogresak/DefinitelyTyped",
"id": "af842ee34b99488a527baf54d96ad170e621dfe9",
"size": "71",
"binary": false,
"copies": "20",
"ref": "refs/heads/master",
"path": "types/carbon__icons-react/lib/currency--shekel/24.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "15"
},
{
"name": "Protocol Buffer",
"bytes": "678"
},
{
"name": "TypeScript",
"bytes": "17426898"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE DvfsHintList [
<!ELEMENT DvfsHintList (Hint?,TspHint+)>
<!ELEMENT Hint EMPTY>
<!ELEMENT TspHint EMPTY>
<!ATTLIST TspHint
scenario_name CDATA #REQUIRED
level CDATA #REQUIRED
head CDATA #IMPLIED
tail CDATA #IMPLIED>
]>
<DvfsHintList>
<Resolution resoltype="Default">
<Hint name="AMS_RESUME" timeout="-1">
<Control type="cpu_min" value="1800000"/>
</Hint>
<Hint name="AMS_RESUME_TAIL" timeout="300">
<Control type="cpu_min" value="1800000"/>
</Hint>
<Hint name="LAUNCHER_TOUCH" timeout="100">
<Control type="cpu_min" value="1900000"/>
<Control type="gpu_min" value="420"/>
</Hint>
<Hint name="DEVICE_WAKEUP" timeout="1000">
<Control type="cpu_min" value="1200000"/>
</Hint>
<Hint name="SCREEN_MIRROR_1_0G" timeout="-1">
<Control type="cpu_min" value="500000"/>
<Control type="core_num_min" value="3"/>
</Hint>
<Hint name="SCREEN_MIRROR_1_2G" timeout="-1">
<Control type="cpu_min" value="600000"/>
<Control type="core_num_min" value="3"/>
</Hint>
<Hint name="MUSIC_STUDIO" timeout="-1">
<Control type="cpu_min" value="650000"/>
</Hint>
</Resolution>
<Resolution resoltype="WQHD">
</Resolution>
<Resolution resoltype="FHD">
</Resolution>
<Resolution resoltype="HD">
</Resolution>
</DvfsHintList>
| {
"content_hash": "091dab39d4acc939db66a2f3dc3a2c0a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 53,
"avg_line_length": 27.767857142857142,
"alnum_prop": 0.557556270096463,
"repo_name": "BatMan-Rom/ModdedFiles",
"id": "c3094c5965a79211427dbf86179d9c8e46cc91ed",
"size": "1555",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "framework-res/res/raw/dvfs_policy_exynos5433_xx.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GLSL",
"bytes": "15069"
},
{
"name": "HTML",
"bytes": "139176"
},
{
"name": "Smali",
"bytes": "541934400"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.regression.rolling.RollingRegressionResults.ssr" href="statsmodels.regression.rolling.RollingRegressionResults.ssr.html" />
<link rel="prev" title="statsmodels.regression.rolling.RollingRegressionResults.rsquared" href="statsmodels.regression.rolling.RollingRegressionResults.rsquared.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.12.2</span>
<span class="md-header-nav__topic"> statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../regression.html" class="md-tabs__link">Linear Regression</a></li>
<li class="md-tabs__item"><a href="statsmodels.regression.rolling.RollingRegressionResults.html" class="md-tabs__link">statsmodels.regression.rolling.RollingRegressionResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.12.2</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../regression.html" class="md-nav__link">Linear Regression</a>
</li>
<li class="md-nav__item">
<a href="../glm.html" class="md-nav__link">Generalized Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a>
</li>
<li class="md-nav__item">
<a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a>
</li>
<li class="md-nav__item">
<a href="../rlm.html" class="md-nav__link">Robust Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a>
</li>
<li class="md-nav__item">
<a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../anova.html" class="md-nav__link">ANOVA</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-regression-rolling-rollingregressionresults-rsquared-adj--page-root">statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj<a class="headerlink" href="#generated-statsmodels-regression-rolling-rollingregressionresults-rsquared-adj--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py attribute">
<dt id="statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj">
<code class="sig-prename descclassname">RollingRegressionResults.</code><code class="sig-name descname">rsquared_adj</code><a class="headerlink" href="#statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj" title="Permalink to this definition">¶</a></dt>
<dd><p>Adjusted R-squared.</p>
<p>This is defined here as 1 - (<cite>nobs</cite>-1)/<cite>df_resid</cite> * (1-<cite>rsquared</cite>)
if a constant is included and 1 - <cite>nobs</cite>/<cite>df_resid</cite> * (1-<cite>rsquared</cite>) if
no constant is included.</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.regression.rolling.RollingRegressionResults.rsquared.html" title="statsmodels.regression.rolling.RollingRegressionResults.rsquared"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.regression.rolling.RollingRegressionResults.rsquared </span>
</div>
</a>
<a href="statsmodels.regression.rolling.RollingRegressionResults.ssr.html" title="statsmodels.regression.rolling.RollingRegressionResults.ssr"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.regression.rolling.RollingRegressionResults.ssr </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Feb 02, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html> | {
"content_hash": "5bbbe647ac491189f78401176b32d955",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 999,
"avg_line_length": 37.78701825557809,
"alnum_prop": 0.6007837243008213,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "5c319ca0b6d81605fd62d9cfb49a36ec5f8ca816",
"size": "18633",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.12.2/generated/statsmodels.regression.rolling.RollingRegressionResults.rsquared_adj.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIC226:policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides" Version="1.0" >
<Description>
Policy for Conformance Test IIC226.
</Description>
<Target/>
<Rule Effect="Permit" RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIC226:rule">
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-equal">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:base64Binary-bag-size">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:base64Binary-intersection">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:base64Binary-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#base64Binary">BQADgY0AMIGJAoGBFK/yHi+g4nRQ3qKrCZGRYY2feUmVrM0QKOzAdrVnP7vhjamt6oDi2mX00w2L</AttributeValue>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#base64Binary">BQADgY0AMIGJAoGBAK/yHi+g4nRQ3qKrCZGRYY2feUmVrM0QKOzAdrVnP7vhjamt6oDi2mX00w2L</AttributeValue>
</Apply>
<AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:test-attr" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#base64Binary" MustBePresent="false"/>
</Apply>
</Apply>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">2</AttributeValue>
</Apply>
</Condition>
</Rule>
</Policy>
| {
"content_hash": "9b49514f88f726f266061133f969f62e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 293,
"avg_line_length": 77.95652173913044,
"alnum_prop": 0.6965978806469604,
"repo_name": "authzforce/core",
"id": "94360aef36ea11c0ba7dd3e2154afa458004cd62",
"size": "1793",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "pdp-testutils/src/test/resources/conformance/xacml-3.0-from-2.0-ct/mandatory/IIC226/Policy.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "195975"
},
{
"name": "Java",
"bytes": "1427390"
},
{
"name": "Shell",
"bytes": "55"
},
{
"name": "XSLT",
"bytes": "66172"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Peserta_model extends CI_Model {
public $table = 'peserta';
public function read_all_peserta($limit=0, $offset=0) {
$this->db->where('is_deleted',0);
$query = $this->db->get($this->table, $limit, $offset);
return $query;
}
public function read_public_peserta($param, $limit=0, $offset=0) {
$this->db->select('username, fullname, biodata_singkat, profpic_path, fb, twitter, instagram, blog, institusi, kota, provinsi');
$this->db->or_like($param);
$this->db->where('is_deleted', 0);
$query = $this->db->get($this->table, $limit, $offset);
return $query;
}
public function read_peserta_by_email($email) {
$this->db->where('email', $email);
$query = $this->db->get($this->table, 1);
return $query;
}
public function get_id($key, $val) {
$this->db->select('peserta_id');
$this->db->where($key, $val);
$query = $this->db->get($this->table, 1);
return $query->result_array()[0]['peserta_id'];
}
public function get_header_info($key, $val) {
$this->db->select('fullname, profpic_path, kota, provinsi, gender');
$this->db->where($key, $val);
$query = $this->db->get($this->table, 1);
return $query->result_array()[0];
}
public function read_peserta_by_username($username) {
$this->db->where('username', $username);
$query = $this->db->get($this->table, 1);
return $query;
}
public function read_ext_data($username) {
$this->db->select('username, agama, institusi, provinsi');
$this->db->where('username', $username);
$query = $this->db->get($this->table, 1);
return $query;
}
public function insert_peserta($data) {
$this->db->insert($this->table, $data);
return ($this->db->affected_rows() != 1) ? $this->db->error() : True;
}
public function update_peserta($idpeserta, $data) {
$this->db->set($data);
$this->db->where('peserta_id', $idpeserta);
$this->db->update($this->table);
return ($this->db->affected_rows() != 1) ? $this->db->error() : True;
}
public function update_profpic($idpeserta, $path) {
$this->db->set('profpic_path', $path);
$this->db->where('peserta_id', $idpeserta);
$this->db->update($this->table);
return ($this->db->affected_rows() != 1) ? $this->db->error() : True;
}
public function completed_data($idpeserta) {
$this->db->set('is_completed', 1);
$this->db->where('peserta_id', $idpeserta);
$this->db->update($this->table);
return ($this->db->affected_rows() != 1) ? $this->db->error() : True;
}
public function is_ready($idpeserta) {
$this->db->select('is_ready');
$this->db->where('peserta_id', $idpeserta);
$result = $this->db->get($this->table)->result_array()[0];
return $result['is_ready'];
}
public function is_video_exist($idpeserta) {
$this->db->select('is_video_exist');
$this->db->where('peserta_id', $idpeserta);
$result = $this->db->get($this->table)->result_array()[0];
return $result['is_video_exist'];
}
public function is_completed($idpeserta) {
$this->db->select('is_completed');
$this->db->where('peserta_id', $idpeserta);
$result = $this->db->get($this->table)->result_array();
return $result[0]['is_completed'];
}
}
?> | {
"content_hash": "3deca9a1594c5e9d730b6852005d4f79",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 130,
"avg_line_length": 30.625,
"alnum_prop": 0.6282574568288855,
"repo_name": "febrianimanda/portal",
"id": "8155224c7b21b752507c01c21a2fd5ce91603fed",
"size": "3185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/models/Peserta_model.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "432"
},
{
"name": "CSS",
"bytes": "11524"
},
{
"name": "HTML",
"bytes": "14163"
},
{
"name": "JavaScript",
"bytes": "585054"
},
{
"name": "PHP",
"bytes": "2030251"
}
],
"symlink_target": ""
} |
package zipkinreceiver
import (
"net/http"
"testing"
"time"
"github.com/openzipkin/zipkin-go/proto/zipkin_proto3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"google.golang.org/protobuf/proto"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/tracetranslator"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin/zipkinv2"
)
func TestConvertSpansToTraceSpans_protobuf(t *testing.T) {
// TODO: (@odeke-em) examine the entire codepath that time goes through
// in Zipkin-Go to ensure that all rounding matches. Otherwise
// for now we need to round Annotation times to seconds for comparison.
cmpTimestamp := func(t time.Time) time.Time {
return t.Round(time.Second)
}
now := cmpTimestamp(time.Date(2018, 10, 31, 19, 43, 35, 789, time.UTC))
minus10hr5ms := cmpTimestamp(now.Add(-(10*time.Hour + 5*time.Millisecond)))
// 1. Generate some spans then serialize them with protobuf
payloadFromWild := &zipkin_proto3.ListOfSpans{
Spans: []*zipkin_proto3.Span{
{
TraceId: []byte{0x7F, 0x6F, 0x5F, 0x4F, 0x3F, 0x2F, 0x1F, 0x0F, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0},
Id: []byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0},
ParentId: []byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0},
Name: "ProtoSpan1",
Kind: zipkin_proto3.Span_CONSUMER,
Timestamp: uint64(now.UnixNano() / 1e3),
Duration: 12e6, // 12 seconds
LocalEndpoint: &zipkin_proto3.Endpoint{
ServiceName: "svc-1",
Ipv4: []byte{0xC0, 0xA8, 0x00, 0x01},
Port: 8009,
},
RemoteEndpoint: &zipkin_proto3.Endpoint{
ServiceName: "memcached",
Ipv6: []byte{0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x53, 0xa7, 0x7c, 0xda, 0x4d, 0xd2, 0x1b},
Port: 11211,
},
},
{
TraceId: []byte{0x7A, 0x6A, 0x5A, 0x4A, 0x3A, 0x2A, 0x1A, 0x0A, 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0},
Id: []byte{0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60},
ParentId: []byte{0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10},
Name: "CacheWarmUp",
Kind: zipkin_proto3.Span_PRODUCER,
Timestamp: uint64(minus10hr5ms.UnixNano() / 1e3),
Duration: 7e6, // 7 seconds
LocalEndpoint: &zipkin_proto3.Endpoint{
ServiceName: "search",
Ipv4: []byte{0x0A, 0x00, 0x00, 0x0D},
Port: 8009,
},
RemoteEndpoint: &zipkin_proto3.Endpoint{
ServiceName: "redis",
Ipv6: []byte{0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x53, 0xa7, 0x7c, 0xda, 0x4d, 0xd2, 0x1b},
Port: 6379,
},
Annotations: []*zipkin_proto3.Annotation{
{
Timestamp: uint64(minus10hr5ms.UnixNano() / 1e3),
Value: "DB reset",
},
{
Timestamp: uint64(minus10hr5ms.UnixNano() / 1e3),
Value: "GC Cycle 39",
},
},
},
},
}
// 2. Serialize it
protoBlob, err := proto.Marshal(payloadFromWild)
require.NoError(t, err, "Failed to protobuf serialize payload: %v", err)
zi := newTestZipkinReceiver()
hdr := make(http.Header)
hdr.Set("Content-Type", "application/x-protobuf")
// 3. Get that payload converted to OpenCensus proto spans.
reqs, err := zi.v2ToTraceSpans(protoBlob, hdr)
require.NoError(t, err, "Failed to parse convert Zipkin spans in Protobuf to Trace spans: %v", err)
require.Equal(t, reqs.ResourceSpans().Len(), 2, "Expecting exactly 2 requests since spans have different node/localEndpoint: %v", reqs.ResourceSpans().Len())
want := ptrace.NewTraces()
want.ResourceSpans().EnsureCapacity(2)
// First span/resource
want.ResourceSpans().AppendEmpty().Resource().Attributes().PutStr(conventions.AttributeServiceName, "svc-1")
span0 := want.ResourceSpans().At(0).ScopeSpans().AppendEmpty().Spans().AppendEmpty()
span0.SetTraceID([16]byte{0x7F, 0x6F, 0x5F, 0x4F, 0x3F, 0x2F, 0x1F, 0x0F, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0})
span0.SetSpanID([8]byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0})
span0.SetParentSpanID([8]byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0})
span0.SetName("ProtoSpan1")
span0.SetStartTimestamp(pcommon.NewTimestampFromTime(now))
span0.SetEndTimestamp(pcommon.NewTimestampFromTime(now.Add(12 * time.Second)))
span0.Attributes().PutStr(conventions.AttributeNetHostIP, "192.168.0.1")
span0.Attributes().PutInt(conventions.AttributeNetHostPort, 8009)
span0.Attributes().PutStr(conventions.AttributeNetPeerName, "memcached")
span0.Attributes().PutStr(conventions.AttributeNetPeerIP, "fe80::1453:a77c:da4d:d21b")
span0.Attributes().PutInt(conventions.AttributeNetPeerPort, 11211)
span0.Attributes().PutStr(tracetranslator.TagSpanKind, string(tracetranslator.OpenTracingSpanKindConsumer))
// Second span/resource
want.ResourceSpans().AppendEmpty().Resource().Attributes().PutStr(conventions.AttributeServiceName, "search")
span1 := want.ResourceSpans().At(1).ScopeSpans().AppendEmpty().Spans().AppendEmpty()
span1.SetTraceID([16]byte{0x7A, 0x6A, 0x5A, 0x4A, 0x3A, 0x2A, 0x1A, 0x0A, 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0})
span1.SetSpanID([8]byte{0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60})
span1.SetParentSpanID([8]byte{0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10})
span1.SetName("CacheWarmUp")
span1.SetStartTimestamp(pcommon.NewTimestampFromTime(now.Add(-10 * time.Hour)))
span1.SetEndTimestamp(pcommon.NewTimestampFromTime(now.Add(-10 * time.Hour).Add(7 * time.Second)))
span1.Attributes().PutStr(conventions.AttributeNetHostIP, "10.0.0.13")
span1.Attributes().PutInt(conventions.AttributeNetHostPort, 8009)
span1.Attributes().PutStr(conventions.AttributeNetPeerName, "redis")
span1.Attributes().PutStr(conventions.AttributeNetPeerIP, "fe80::1453:a77c:da4d:d21b")
span1.Attributes().PutInt(conventions.AttributeNetPeerPort, 6379)
span1.Attributes().PutStr(tracetranslator.TagSpanKind, string(tracetranslator.OpenTracingSpanKindProducer))
span1.Events().EnsureCapacity(2)
span1.Events().AppendEmpty().SetName("DB reset")
span1.Events().At(0).SetTimestamp(pcommon.NewTimestampFromTime(now.Add(-10 * time.Hour)))
span1.Events().AppendEmpty().SetName("GC Cycle 39")
span1.Events().At(1).SetTimestamp(pcommon.NewTimestampFromTime(now.Add(-10 * time.Hour)))
assert.Equal(t, want.SpanCount(), reqs.SpanCount())
assert.Equal(t, want.ResourceSpans().Len(), reqs.ResourceSpans().Len())
for i := 0; i < want.ResourceSpans().Len(); i++ {
wantRS := want.ResourceSpans().At(i)
wSvcName, ok := wantRS.Resource().Attributes().Get(conventions.AttributeServiceName)
assert.True(t, ok)
for j := 0; j < reqs.ResourceSpans().Len(); j++ {
reqsRS := reqs.ResourceSpans().At(j)
rSvcName, ok := reqsRS.Resource().Attributes().Get(conventions.AttributeServiceName)
assert.True(t, ok)
if rSvcName.Str() == wSvcName.Str() {
compareResourceSpans(t, wantRS, reqsRS)
}
}
}
}
func newTestZipkinReceiver() *zipkinReceiver {
cfg := createDefaultConfig().(*Config)
return &zipkinReceiver{
config: cfg,
jsonUnmarshaler: zipkinv2.NewJSONTracesUnmarshaler(cfg.ParseStringTags),
protobufUnmarshaler: zipkinv2.NewProtobufTracesUnmarshaler(false, cfg.ParseStringTags),
protobufDebugUnmarshaler: zipkinv2.NewProtobufTracesUnmarshaler(true, cfg.ParseStringTags),
}
}
func compareResourceSpans(t *testing.T, wantRS ptrace.ResourceSpans, reqsRS ptrace.ResourceSpans) {
assert.Equal(t, wantRS.ScopeSpans().Len(), reqsRS.ScopeSpans().Len())
wantIL := wantRS.ScopeSpans().At(0)
reqsIL := reqsRS.ScopeSpans().At(0)
assert.Equal(t, wantIL.Spans().Len(), reqsIL.Spans().Len())
}
| {
"content_hash": "4d55ee9e2a063e3e41a2ab756c011f96",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 158,
"avg_line_length": 46.20710059171598,
"alnum_prop": 0.7072608528620822,
"repo_name": "open-telemetry/opentelemetry-collector-contrib",
"id": "7e523f42eaa48ad22150ce092cff233939c78aad",
"size": "8409",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "receiver/zipkinreceiver/proto_parse_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2677"
},
{
"name": "Go",
"bytes": "14675167"
},
{
"name": "Makefile",
"bytes": "22547"
},
{
"name": "PowerShell",
"bytes": "2781"
},
{
"name": "Shell",
"bytes": "11998"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
namespace Azure.ResourceManager.Compute.Models
{
public partial class VirtualMachineScaleSetVMListResult
{
internal static VirtualMachineScaleSetVMListResult DeserializeVirtualMachineScaleSetVMListResult(JsonElement element)
{
IReadOnlyList<VirtualMachineScaleSetVM> value = default;
string nextLink = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("value"))
{
List<VirtualMachineScaleSetVM> array = new List<VirtualMachineScaleSetVM>();
foreach (var item in property.Value.EnumerateArray())
{
if (item.ValueKind == JsonValueKind.Null)
{
array.Add(null);
}
else
{
array.Add(VirtualMachineScaleSetVM.DeserializeVirtualMachineScaleSetVM(item));
}
}
value = array;
continue;
}
if (property.NameEquals("nextLink"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
nextLink = property.Value.GetString();
continue;
}
}
return new VirtualMachineScaleSetVMListResult(value, nextLink);
}
}
}
| {
"content_hash": "5ca3d817142e364825ce6cebe6bf52ff",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 125,
"avg_line_length": 37.044444444444444,
"alnum_prop": 0.4913017396520696,
"repo_name": "stankovski/azure-sdk-for-net",
"id": "957436792739b2187fec52e0dc86a64869b3685e",
"size": "1805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMListResult.Serialization.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "33972632"
},
{
"name": "Cucumber",
"bytes": "89597"
},
{
"name": "Shell",
"bytes": "675"
}
],
"symlink_target": ""
} |
<?php
namespace ProophTest\Link\ProcessManager\Mock\ProcessingType;
use Prooph\Processing\Type\AbstractCollection;
use Prooph\Processing\Type\Description\Description;
use Prooph\Processing\Type\Description\NativeType;
use Prooph\Processing\Type\Prototype;
final class ArticleCollection extends AbstractCollection
{
/**
* Returns the prototype of the items type
*
* A collection has always one property with name item representing the type of all items in the collection.
*
* @return Prototype
*/
public static function itemPrototype()
{
return Article::prototype();
}
/**
* @return Description
*/
public static function buildDescription()
{
return new Description('Article List', NativeType::COLLECTION, false);
}
} | {
"content_hash": "f381482133e0b8214ab2f8279da1238c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 112,
"avg_line_length": 25.25,
"alnum_prop": 0.7066831683168316,
"repo_name": "prooph/link-process-manager",
"id": "3e2226a35882a0a609fcde340fd3e2b37da2817e",
"size": "1069",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/ProcessManager/Mock/ProcessingType/ArticleCollection.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2927"
},
{
"name": "HTML",
"bytes": "93418"
},
{
"name": "PHP",
"bytes": "323957"
}
],
"symlink_target": ""
} |
{% extends 'catalog/base.html' %}
{% load static %}
{% block content %}
<div style="text-align:center;">
<h3>404 - File Not Found</h3>
<a href="http://nincatalog.com"><img src="{% static 'catalog/img/strobelight.jpg' %}"></a>
</div>
{% endblock %}
| {
"content_hash": "ee516ed745b5ea171c2bf992399cbba5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 90,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6265060240963856,
"repo_name": "bgalbraith/nincatalog",
"id": "9d205accdb8fac34b2d1ca9f1ff62c3ebccbddc5",
"size": "249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "catalog/templates/catalog/404.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3647"
},
{
"name": "HTML",
"bytes": "10747"
},
{
"name": "Python",
"bytes": "41699"
}
],
"symlink_target": ""
} |
A port of 'assert' for cortex from node.js, make your node code run in browsers.
## Usage
[Node.js Assertion Testing](http://nodejs.org/api/assert.html) | {
"content_hash": "880a6f0912ad85aa0ab03aba7d1473d6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 80,
"avg_line_length": 30.8,
"alnum_prop": 0.7402597402597403,
"repo_name": "cortex-packages/browser-assert",
"id": "0cbbc7e882dd9886bc1e5b76d69244ae78a85c64",
"size": "294",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10994"
}
],
"symlink_target": ""
} |
from distutils.core import setup
from glob import glob
setup(name = 'shrinkypic',
version = '0.1.r26',
description = "Image Processing Application",
long_description = "ShrinkyPic is a simple image processing application that provides a (very) small interface for Imagemagick.",
maintainer = "Dennis Drescher",
maintainer_email = "dennis_drescher@sil.org",
package_dir = {'':'lib'},
packages = ["shrinkypic", 'shrinkypic.dialog', 'shrinkypic.icon', 'shrinkypic.process'],
scripts = glob("shrinkypic*"),
license = 'LGPL',
)
| {
"content_hash": "0f2782ebceff715086430a53dae8e545",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 137,
"avg_line_length": 35.529411764705884,
"alnum_prop": 0.6423841059602649,
"repo_name": "thresherdj/shrinkypic",
"id": "ac9d366577d98b4b59bed1e5d5c6f571c81ba203",
"size": "1604",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "139241"
},
{
"name": "Shell",
"bytes": "555"
}
],
"symlink_target": ""
} |
module Messaging
class MessageRegistry
class Error < RuntimeError; end
include Log::Dependency
def message_classes
@message_classes ||= []
end
def message_types
message_classes.map do |message_class|
message_class.message_type
end
end
def get(message_name)
message_classes.find do |message_class|
message_class.message_name == message_name
end
end
def register(message_class)
logger.trace { "Registering #{message_class}"}
if registered?(message_class)
error_msg = "#{message_class} is already registered"
logger.error { error_msg }
raise Error, error_msg
end
message_classes << message_class
logger.debug { "Registered #{message_class}"}
message_classes
end
def registered?(message_class)
message_classes.include?(message_class)
end
def length
message_classes.length
end
end
end
| {
"content_hash": "c7d04b23e89f6c8694eb99ac46e6eff4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 60,
"avg_line_length": 21.043478260869566,
"alnum_prop": 0.6332644628099173,
"repo_name": "eventide-project/messaging",
"id": "524775a19a417742eae30645e60b3b73813384da",
"size": "968",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/messaging/message_registry.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "173455"
},
{
"name": "Shell",
"bytes": "1938"
}
],
"symlink_target": ""
} |
package com.realcomp.prime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DataSetID {
//prefix + type + geostate + geocounty + source + year + month + day + name;
protected static final Pattern SPLIT_ID_PATTERN = Pattern.compile(
"([A-Za-z0-9\\-_:]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/([_A-Za-z0-9\\. \\-_]+)");
protected static final Pattern SPLIT_PREFIXED_ID_PATTERN = Pattern.compile(
"(.*)/([A-Za-z0-9\\-_:]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/([A-Za-z0-9\\. \\-_]+)");
//prefix + type + geography + source + version + name;
protected static final Pattern ID_PATTERN = Pattern.compile(
"([A-Za-z0-9\\-_:]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([0-9]+)/([_A-Za-z0-9\\. \\-_]+)");
protected static final Pattern PREFIXED_ID_PATTERN = Pattern.compile(
"(.*)/([A-Za-z0-9\\-_:]+)/([A-Za-z0-9\\-_]+)/([A-Za-z0-9\\-_]+)/([0-9]+)/([A-Za-z0-9\\. \\-_]+)");
protected String prefix;
protected String type;
protected String geography;
protected String source;
protected String version;
protected String name;
public DataSetID(){
}
public static DataSetID parse(String path){
Matcher matcher = SPLIT_ID_PATTERN.matcher(path);
boolean prefix = false, split = false;
if (!matcher.matches()){
matcher = SPLIT_PREFIXED_ID_PATTERN.matcher(path);
if (matcher.matches()) {
prefix = true;
split = true;
} else {
matcher = ID_PATTERN.matcher(path);
if (!matcher.matches()){
matcher = PREFIXED_ID_PATTERN.matcher(path);
if (matcher.matches()) {
prefix = true;
} else {
throw new IllegalArgumentException("Unable to parse [" + path + "] as a DataSetID");
}
}
}
} else {
split = true;
}
DataSetID id = new DataSetID();
if(split) {
if (prefix) {
id.setPrefix(matcher.group(1));
id.setType(matcher.group(2));
id.setGeography(matcher.group(3) + matcher.group(4));
id.setSource(matcher.group(5));
id.setVersion(matcher.group(6) + matcher.group(7) + matcher.group(8));
id.setName(matcher.group(9));
} else {
id.setPrefix("");
id.setType(matcher.group(1));
id.setGeography(matcher.group(2) + matcher.group(3));
id.setSource(matcher.group(4));
id.setVersion(matcher.group(5) + matcher.group(6) + matcher.group(7));
id.setName(matcher.group(8));
}
} else {
if (prefix) {
id.setPrefix(matcher.group(1));
id.setType(matcher.group(2));
id.setGeography(matcher.group(3));
id.setSource(matcher.group(4));
id.setVersion(matcher.group(5));
id.setName(matcher.group(6));
} else {
id.setPrefix("");
id.setType(matcher.group(1));
id.setGeography(matcher.group(2));
id.setSource(matcher.group(3));
id.setVersion(matcher.group(4));
id.setName(matcher.group(5));
}
}
return id;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getGeography() {
return geography;
}
public void setGeography(String geography) {
this.geography = geography;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| {
"content_hash": "2d809163a2de5fc5b34a96439f6a2e37",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 153,
"avg_line_length": 32.56934306569343,
"alnum_prop": 0.5,
"repo_name": "real-comp/prime",
"id": "b9b21575dfde6434fad9f6b5f3674a5a01542d6d",
"size": "4462",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/realcomp/prime/DataSetID.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "558645"
}
],
"symlink_target": ""
} |
/*
* RMT.h
*
* Created on: Mar 1, 2017
* Author: kolban
*/
#ifndef COMPONENTS_CPP_UTILS_RMT_H_
#define COMPONENTS_CPP_UTILS_RMT_H_
#include <driver/rmt.h>
#include <vector>
/**
* @brief Drive the %RMT peripheral.
*/
class RMT {
public:
RMT(gpio_num_t pin, rmt_channel_t channel=RMT_CHANNEL_0);
virtual ~RMT();
void add(bool level, uint32_t duration);
void clear();
void rxStart();
void rxStop();
void txStart();
void txStop();
void write();
private:
rmt_channel_t channel;
std::vector<rmt_item32_t> items;
int bitCount = 0;
};
#endif /* COMPONENTS_CPP_UTILS_RMT_H_ */
| {
"content_hash": "0083564aeb9c29d09c107b857b50c4d4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 58,
"avg_line_length": 17.085714285714285,
"alnum_prop": 0.6538461538461539,
"repo_name": "FulminatingGhost/esp32-snippets",
"id": "90e59007386ce8fdb0e281f6220c0d81310aad41",
"size": "598",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "cpp_utils/RMT.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Arduino",
"bytes": "76445"
},
{
"name": "C",
"bytes": "1747047"
},
{
"name": "C++",
"bytes": "943695"
},
{
"name": "HTML",
"bytes": "12081"
},
{
"name": "JavaScript",
"bytes": "2087"
},
{
"name": "Makefile",
"bytes": "13165"
},
{
"name": "Shell",
"bytes": "3899"
}
],
"symlink_target": ""
} |
namespace riakboost{} namespace boost = riakboost; namespace riakboost{
namespace asio {
namespace detail {
struct posix_static_mutex
{
typedef riakboost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock;
// Initialise the mutex.
void init()
{
// Nothing to do.
}
// Lock the mutex.
void lock()
{
(void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL.
}
// Unlock the mutex.
void unlock()
{
(void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL.
}
::pthread_mutex_t mutex_;
};
#define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER }
} // namespace detail
} // namespace asio
} // namespace riakboost
#include <boost/asio/detail/pop_options.hpp>
#endif // defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS)
#endif // BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
| {
"content_hash": "694cc111f16f3754a1410f0ee537ce2f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 21.3,
"alnum_prop": 0.6830985915492958,
"repo_name": "basho-labs/riak-cxx-client",
"id": "db45581135aecdbd161d32699db58e11ac02296a",
"size": "1599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deps/boost-1.47.0/boost/asio/detail/posix_static_mutex.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "4509"
},
{
"name": "C++",
"bytes": "130887"
},
{
"name": "Protocol Buffer",
"bytes": "7146"
},
{
"name": "Shell",
"bytes": "326442"
}
],
"symlink_target": ""
} |
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test
def TestCommand(test):
def run(self):
import pytest
from blognajd.tests import setup_django_settings
setup_django_settings()
pytest.main(['-v',])
# def run_tests(*args):
# from blognajd.tests import run_tests, delete_tmp_dirs
# errors = run_tests()
# delete_tmp_dirs()
# if errors:
# sys.exit(1)
# else:
# sys.exit(0)
# test.run_tests = run_tests
setup(
name = "blognajd",
version = "1.1.1",
packages = find_packages(),
keywords = "django apps",
license = "MIT",
description = "Simple django blogging application",
long_description = "A simple pluggable well maintained django blogging application, tested and fully compatible with Django 1.8 and Python 3.4.",
author = "Daniel Rus Morales",
author_email = "mbox@danir.us",
maintainer = "Daniel Rus Morales",
maintainer_email = "mbox@danir.us",
url = "http://pypi.python.org/pypi/blognajd/",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: News/Diary',
'Framework :: Django',
'Framework :: Django :: 1.7',
'Framework :: Django :: 1.8',
],
include_package_data = True,
package_data = {
'blognajd': ['*.css', '*.js', '*.html']
},
cmdclass={'test': TestCommand},
)
| {
"content_hash": "a0c38e3b4138997d095a81fc51c7c710",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 149,
"avg_line_length": 33.05357142857143,
"alnum_prop": 0.6039978390059427,
"repo_name": "danirus/blognajd",
"id": "6e83a892a5d9e4015783d7b550e4405a9cb7c093",
"size": "1851",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17433"
},
{
"name": "HTML",
"bytes": "28956"
},
{
"name": "Python",
"bytes": "85405"
},
{
"name": "Shell",
"bytes": "354"
}
],
"symlink_target": ""
} |
<?php
namespace ZendTest\Stratigility\Middleware;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use Zend\Stratigility\Middleware\OriginalMessages;
class OriginalMessagesTest extends TestCase
{
public function setUp()
{
$this->uri = $this->prophesize(UriInterface::class);
$this->request = $this->prophesize(ServerRequestInterface::class);
$this->response = $this->prophesize(ResponseInterface::class);
}
public function testNotPassingNextArgumentReturnsResponseVerbatim()
{
$middleware = new OriginalMessages();
$this->request->getUri()->shouldNotBeCalled();
$response = $middleware(
$this->request->reveal(),
$this->response->reveal()
);
$this->assertSame($this->response->reveal(), $response);
}
public function testNextReceivesRequestWithNewAttributes()
{
$middleware = new OriginalMessages();
$expected = $this->prophesize(ResponseInterface::class)->reveal();
$next = function ($request, $response) use ($expected) {
return $expected;
};
$this->request->getUri()->will([$this->uri, 'reveal']);
$this->request->withAttribute(
'originalUri',
Argument::that(function ($arg) {
$this->assertSame($this->uri->reveal(), $arg);
return $arg;
})
)->will([$this->request, 'reveal']);
$this->request->withAttribute(
'originalRequest',
Argument::that(function ($arg) {
$this->assertSame($this->request->reveal(), $arg);
return $arg;
})
)->will([$this->request, 'reveal']);
$this->request->withAttribute(
'originalResponse',
Argument::that(function ($arg) {
$this->assertSame($this->response->reveal(), $arg);
return $arg;
})
)->will([$this->request, 'reveal']);
$response = $middleware(
$this->request->reveal(),
$this->response->reveal(),
$next
);
$this->assertSame($expected, $response);
}
}
| {
"content_hash": "eb0425b559e0454536c8c1388ab830c6",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 76,
"avg_line_length": 30.103896103896105,
"alnum_prop": 0.5733390854184642,
"repo_name": "xtreamwayz/zend-stratigility",
"id": "3c3de79cfee1cef4bffe47fa3d382012e185e049",
"size": "2612",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Middleware/OriginalMessagesTest.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "108061"
}
],
"symlink_target": ""
} |
KERNEL_DIR=/media/ExtendedLinux/linux-sunxi
#KERNEL_DIR=/media/a852afe7-e4bb-48b6-a1da-7583947c84d4/sunxi-jorda/linux-sunxi
ifneq ($(KERNELRELEASE),)
obj-m := therm.o
therm-objs := char_dev.o BitOperations.o OneWire.o Led.o DiscoveryProtocol.o SensorID.o LinkedList.o SensorOperations.o TemperatureScratchpad.o TemperatureResolution.o
else
KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-eabi- -C ${KERNEL_DIR} M=$(PWD) modules
alexmac:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-eabi- -C ${KERNEL_DIR} M=$(PWD) modules
scp -P 2220 -r *.o *.mod.* *.ko *.sh modules.order Module.symvers .*.cmd .tmp_versions camsi6@camsi.ups-tlse.fr:~/AlexMattijs
/media/storage/linux-sunxissh -p 2220 camsi6@camsi.ups-tlse.fr
alexfac:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-eabi- -C ${KERNEL_DIR} M=$(PWD) modules
scp -r *.o *.mod.* *.ko *.sh modules.order Module.symvers .*.cmd .tmp_versions root@olinuxino:~/AlexMattijs
ssh root@olinuxino
matt:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-eabi- -C ${KERNEL_DIR} M=$(PWD) modules
scp -r *.o *.mod.* *.ko *.sh modules.order Module.symvers .*.cmd .tmp_versions root@olinuxino:~/AlexMattijs
matthome:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -Wall -C ${KERNEL_DIR} M=$(PWD) modules
scp -r *.o *.mod.* *.ko *.sh modules.order Module.symvers .*.cmd .tmp_versions Makefile Tests/ root@192.168.0.1:~/AlexMattijs
clean:
rm -rf *.o *.ko.* *.mod.* *.ko .[a-z] modules.order Module.symvers .*.cmd
endif
setResolution:
gcc -Wall Tests/SetResolution.c -o setResolution
getTemperature:
gcc -Wall Tests/GetTemperature.c -o getTemperature
| {
"content_hash": "bbc9b9f89dd997f272c52f716971381f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 168,
"avg_line_length": 50.96875,
"alnum_prop": 0.7198038013488657,
"repo_name": "Makohoek/onewire-thermometer",
"id": "817e0fc294010a7910d108c6be6ca3fc8de3b117",
"size": "1671",
"binary": false,
"copies": "1",
"ref": "refs/heads/code",
"path": "src/Makefile",
"mode": "33261",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
namespace open {
class RenderTechnique : public TPtr<IRenderTechnique> {
public:
RenderTechnique();
~RenderTechnique();
virtual void addRenderPass(IRenderPass* renderPass);
virtual IRenderPass* getRenderPass(uint32 i = 0);
virtual uint32 getNumRenderPass();
private:
struct Imp;
Imp* _imp;
};
}
#endif | {
"content_hash": "6ffcbe7edf1e3715b51085ec7f48f6cd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 56,
"avg_line_length": 17.944444444444443,
"alnum_prop": 0.7275541795665634,
"repo_name": "spotsking/open",
"id": "8c047a5b3cbc45bc757276bb3862fdc7ca624b80",
"size": "458",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "main/src/Render/Material/RenderTechnique.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1396071"
},
{
"name": "C++",
"bytes": "796299"
},
{
"name": "GLSL",
"bytes": "8368"
}
],
"symlink_target": ""
} |
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>ScalaTest 3.0.7 - org.scalatest.selenium.WebBrowser.RadioButton</title>
<meta name="description" content="ScalaTest 3.0.7 - org.scalatest.selenium.WebBrowser.RadioButton" />
<meta name="keywords" content="ScalaTest 3.0.7 org.scalatest.selenium.WebBrowser.RadioButton" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../../../lib/index.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />
<script type="text/javascript" src="../../../lib/jquery.js"></script>
<script type="text/javascript" src="../../../lib/jquery.panzoom.min.js"></script>
<script type="text/javascript" src="../../../lib/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="../../../lib/index.js"></script>
<script type="text/javascript" src="../../../index.js"></script>
<script type="text/javascript" src="../../../lib/scheduler.js"></script>
<script type="text/javascript" src="../../../lib/template.js"></script>
<script type="text/javascript" src="../../../lib/tools.tooltip.js"></script>
<script type="text/javascript">
/* this variable can be used by the JS to determine the path to the root document */
var toRoot = '../../../';
</script>
<!-- gtag [javascript] -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-71294502-1"></script>
<script defer>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-71294502-1');
</script>
</head>
<body>
<div id="search">
<span id="doc-title">ScalaTest 3.0.7<span id="doc-version"></span></span>
<span class="close-results"><span class="left"><</span> Back</span>
<div id="textfilter">
<span class="input">
<input autocapitalize="none" placeholder="Search" id="index-input" type="text" accesskey="/" />
<i class="clear material-icons"></i>
<i id="search-icon" class="material-icons"></i>
</span>
</div>
</div>
<div id="search-results">
<div id="search-progress">
<div id="progress-fill"></div>
</div>
<div id="results-content">
<div id="entity-results"></div>
<div id="member-results"></div>
</div>
</div>
<div id="content-scroll-container" style="-webkit-overflow-scrolling: touch;">
<div id="content-container" style="-webkit-overflow-scrolling: touch;">
<div id="subpackage-spacer">
<div id="packages">
<h1>Packages</h1>
<ul>
<li name="_root_.root" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="_root_"></a><a id="root:_root_"></a>
<span class="permalink">
<a href="index.html#_root_" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">package</span>
</span>
<span class="symbol">
<a title="" href="../../../index.html"><span class="name">root</span></a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../../../index.html" class="extype" name="_root_">root</a></dd></dl></div>
</li><li name="_root_.org" visbl="pub" class="indented1 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="org"></a><a id="org:org"></a>
<span class="permalink">
<a href="index.html#org" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">package</span>
</span>
<span class="symbol">
<a title="" href="../../index.html"><span class="name">org</span></a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../../../index.html" class="extype" name="_root_">root</a></dd></dl></div>
</li><li name="org.scalatest" visbl="pub" class="indented2 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="scalatest"></a><a id="scalatest:scalatest"></a>
<span class="permalink">
<a href="../org/index.html#scalatest" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">package</span>
</span>
<span class="symbol">
<a title="ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter." href="../index.html"><span class="name">scalatest</span></a>
</span>
<p class="shortcomment cmt">ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.</p><div class="fullcomment"><div class="comment cmt"><p>ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.
</p></div><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../../index.html" class="extype" name="org">org</a></dd></dl></div>
</li><li name="org.scalatest.selenium" visbl="pub" class="indented3 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="selenium"></a><a id="selenium:selenium"></a>
<span class="permalink">
<a href="../../org/scalatest/index.html#selenium" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">package</span>
</span>
<span class="symbol">
<a title="" href="index.html"><span class="name">selenium</span></a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="../index.html" class="extype" name="org.scalatest">scalatest</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser" visbl="pub" class="indented4 " data-isabs="true" fullComment="yes" group="Ungrouped">
<a id="WebBrowserextendsAnyRef"></a><a id="WebBrowser:WebBrowser"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/index.html#WebBrowserextendsAnyRef" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">trait</span>
</span>
<span class="symbol">
<a title="Trait that provides a domain specific language (DSL) for writing browser-based tests using Selenium." href="WebBrowser.html"><span class="name deprecated" title="Deprecated: WebBrowser has been moved from org.scalatest.selenium to org.scalatestplus.selenium. Please update your imports, as this deprecated type alias will be removed in a future version of ScalaTest.">WebBrowser</span></a><span class="result"> extends <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
<p class="shortcomment cmt">Trait that provides a domain specific language (DSL) for writing browser-based tests using <a href="http://seleniumhq.org">Selenium</a>.</p><div class="fullcomment"><div class="comment cmt"><p>Trait that provides a domain specific language (DSL) for writing browser-based tests using <a href="http://seleniumhq.org">Selenium</a>.</p><p>To use ScalaTest's Selenium DSL, mix trait <code>WebBrowser</code> into your test class. This trait provides the DSL in its
entirety except for one missing piece: an implicit <code>org.openqa.selenium.WebDriver</code>. One way to provide the missing
implicit driver is to declare one as a member of your test class, like this:</p><p><pre class="stHighlighted">
<span class="stReserved">import</span> org.scalatest._
<span class="stReserved">import</span> selenium._
<span class="stReserved">import</span> org.openqa.selenium._
<span class="stReserved">import</span> htmlunit._
<br/><span class="stReserved">class</span> <span class="stType">BlogSpec</span> <span class="stReserved">extends</span> <span class="stType">FlatSpec</span> <span class="stReserved">with</span> <span class="stType">Matchers</span> <span class="stReserved">with</span> <span class="stType">WebBrowser</span> {
<br/> <span class="stReserved">implicit</span> <span class="stReserved">val</span> webDriver: <span class="stType">WebDriver</span> = <span class="stReserved">new</span> <span class="stType">HtmlUnitDriver</span>
<br/> <span class="stReserved">val</span> host = <span class="stQuotedString">"http://localhost:9000/"</span>
<br/> <span class="stQuotedString">"The blog app home page"</span> should <span class="stQuotedString">"have the correct title"</span> in {
go to (host + <span class="stQuotedString">"index.html"</span>)
pageTitle should be (<span class="stQuotedString">"Awesome Blog"</span>)
}
}
</pre></p><p>For convenience, however, ScalaTest provides a <code>WebBrowser</code> subtrait containing an implicit <code>WebDriver</code> for each
driver provided by Selenium.
Thus a simpler way to use the <code>HtmlUnit</code> driver, for example, is to extend
ScalaTest's <a href="HtmlUnit.html"><code>HtmlUnit</code></a> trait, like this:</p><p><pre class="stHighlighted">
<span class="stReserved">import</span> org.scalatest._
<span class="stReserved">import</span> selenium._
<br/><span class="stReserved">class</span> <span class="stType">BlogSpec</span> <span class="stReserved">extends</span> <span class="stType">FlatSpec</span> <span class="stReserved">with</span> <span class="stType">Matchers</span> <span class="stReserved">with</span> <span class="stType">HtmlUnit</span> {
<br/> <span class="stReserved">val</span> host = <span class="stQuotedString">"http://localhost:9000/"</span>
<br/> <span class="stQuotedString">"The blog app home page"</span> should <span class="stQuotedString">"have the correct title"</span> in {
go to (host + <span class="stQuotedString">"index.html"</span>)
pageTitle should be (<span class="stQuotedString">"Awesome Blog"</span>)
}
}
</pre></p><p>The web driver traits provided by ScalaTest are:</p><p><table style="border-collapse: collapse; border: 1px solid black">
<tr><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong>Driver</strong></th><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong><code>WebBrowser</code> subtrait</strong></th></tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
Google Chrome
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<a href="Chrome.html"><code>Chrome</code></a>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
Mozilla Firefox
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<a href="Firefox.html"><code>Firefox</code></a>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
HtmlUnit
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<a href="HtmlUnit.html"><code>HtmlUnit</code></a>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
Microsoft Internet Explorer
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<a href="InternetExplorer.html"><code>InternetExplorer</code></a>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
Apple Safari
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<a href="Safari.html"><code>Safari</code></a>
</td>
</tr>
</table></p><h4> Navigation </h4><p>You can ask the browser to retrieve a page (go to a URL) like this:</p><p><pre class="stHighlighted">
go to <span class="stQuotedString">"http://www.artima.com"</span>
</pre></p><p>Note: If you are using the <em>page object pattern</em>, you can also go to a page using the <code>Page</code> instance, as
illustrated in the section on <a href="#pageObjects">page objects</a> below.</p><p>Once you have retrieved a page, you can fill in and submit forms, query for the values of page elements, and make assertions.
In the following example, selenium will go to <code>http://www.google.com</code>, fill in the text box with
<code>Cheese!</code>, press the submit button, and wait for result returned from an AJAX call:</p><p><pre class="stHighlighted">
go to <span class="stQuotedString">"http://www.google.com"</span>
click on <span class="stQuotedString">"q"</span>
enter(<span class="stQuotedString">"Cheese!"</span>)
submit()
<span class="stLineComment">// Google's search is rendered dynamically with JavaScript.</span>
eventually { pageTitle should be (<span class="stQuotedString">"Cheese! - Google Search"</span>) }
</pre></p><p>In the above example, the <code>"q"</code> used in “<code>click on "q"</code>”
can be either the id or name of an element. ScalaTest's Selenium DSL will try to lookup by id first. If it cannot find
any element with an id equal to <code>"q"</code>, it will then try lookup by name <code>"q"</code>.</p><p>Alternatively, you can be more specific:</p><p><pre class="stHighlighted">
click on id(<span class="stQuotedString">"q"</span>) <span class="stLineComment">// to lookup by id "q" </span>
click on name(<span class="stQuotedString">"q"</span>) <span class="stLineComment">// to lookup by name "q" </span>
</pre></p><p>In addition to <code>id</code> and <code>name</code>, you can use the following approaches to lookup elements, just as you can do with
Selenium's <code>org.openqa.selenium.By</code> class:</p><ul><li><code>xpath</code></li><li><code>className</code></li><li><code>cssSelector</code></li><li><code>linkText</code></li><li><code>partialLinkText</code></li><li><code>tagName</code></li></ul><p>For example, you can select by link text with:</p><p><pre class="stHighlighted">
click on linkText(<span class="stQuotedString">"click here!"</span>)
</pre></p><p>If an element is not found via any form of lookup, evaluation will complete abruptly with a <code>TestFailedException</code>.</p><h4> Getting and setting input element values </h4><p>ScalaTest's Selenium DSL provides a clear, simple syntax for accessing and updating the values of input elements such as
text fields, radio buttons, checkboxes, selection lists, and the input types introduced in HTML5. If a requested element is not found, or if it is found but is
not of the requested type, an exception will immediately result causing the test to fail.</p><p>The most common way to access field value is through the <code>value</code> property, which is supported by the following
input types:</p><p><table style="border-collapse: collapse; border: 1px solid black">
<tr>
<th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black">
<strong>Tag Name</strong>
</th>
<th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black">
<strong>Input Type</strong>
</th>
<th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black">
<strong>Lookup Method</strong>
</th>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>text</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>textField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>textarea</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>-</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>textArea</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>password</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>pwdField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>email</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>emailField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>color</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>colorField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>date</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>dateField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>datetime</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>dateTimeField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>datetime-local</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>dateTimeLocalField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>month</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>monthField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>number</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>numberField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>range</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>rangeField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>search</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>searchField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>tel</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>telField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>time</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>timeField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>url</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>urlField</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>input</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>week</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: center">
<code>weekField</code>
</td>
</tr>
</table></p><p>You can change a input field's value by assigning it via the <code>=</code> operator, like this:</p><p><pre class="stHighlighted">
textField(<span class="stQuotedString">"q"</span>).value = <span class="stQuotedString">"Cheese!"</span>
</pre></p><p>And you can access a input field's value by simply invoking <code>value</code> on it:</p><p><pre class="stHighlighted">
textField(<span class="stQuotedString">"q"</span>).value should be (<span class="stQuotedString">"Cheese!"</span>)
</pre></p><p>If the text field is empty, <code>value</code> will return an empty string (<code>""</code>).</p><p>You can use the same syntax with other type of input fields by replacing <code>textField</code> with <code>Lookup Method</code> listed in table above,
for example to use text area:</p><p><pre class="stHighlighted">
textArea(<span class="stQuotedString">"body"</span>).value = <span class="stQuotedString">"I saw something cool today!"</span>
textArea(<span class="stQuotedString">"body"</span>).value should be (<span class="stQuotedString">"I saw something cool today!"</span>)
</pre></p><p>or with a password field:</p><p><pre class="stHighlighted">
pwdField(<span class="stQuotedString">"secret"</span>).value = <span class="stQuotedString">"Don't tell anybody!"</span>
pwdField(<span class="stQuotedString">"secret"</span>).value should be (<span class="stQuotedString">"Don't tell anybody!"</span>)
</pre></p><h5> Alternate Way for Data Entry </h5><p>An alternate way to enter data into a input fields is to use <code>enter</code> or <code>pressKeys</code>.
Although both of <code>enter</code> and <code>pressKeys</code> send characters to the active element, <code>pressKeys</code> can be used on any kind of
element, whereas <code>enter</code> can only be used on text entry fields, which include:</p><ul><li><code>textField</code></li><li><code>textArea</code></li><li><code>pwdField</code></li><li><code>emailField</code></li><li><code>searchField</code></li><li><code>telField</code></li><li><code>urlField</code></li></ul><p>Another difference is that <code>enter</code> will clear the text field or area before sending the characters,
effectively replacing any currently existing text with the new text passed to <code>enter</code>. By contrast,
<code>pressKeys</code> does not do any clearing—it just appends more characters to any existing text.
You can backup with <code>pressKeys</code>, however, by sending explicit backspace characters, <code>"\u0008"</code>.</p><p>To use these commands, you must first click on the input field you are interested in
to give it the focus. Here's an example:</p><p><pre class="stHighlighted">
click on <span class="stQuotedString">"q"</span>
enter(<span class="stQuotedString">"Cheese!"</span>)
</pre></p><p>Here's a (contrived) example of using <code>pressKeys</code> with backspace to fix a typo:</p><p><pre class="stHighlighted">
click on <span class="stQuotedString">"q"</span> <span class="stLineComment">// q is the name or id of a text field or text area</span>
enter(<span class="stQuotedString">"Cheesey!"</span>) <span class="stLineComment">// Oops, meant to say Cheese!</span>
pressKeys(<span class="stQuotedString">"\u0008\u0008"</span>) <span class="stLineComment">// Send two backspaces; now the value is Cheese</span>
pressKeys(<span class="stQuotedString">"!"</span>) <span class="stLineComment">// Send the missing exclamation point; now the value is Cheese!</span>
</pre></p><h5> Radio buttons </h5><p>Radio buttons work together in groups. For example, you could have a group of radio buttons, like this:</p><p><pre>
<input type="radio" id="opt1" name="group1" value="Option 1"> Option 1</input>
<input type="radio" id="opt2" name="group1" value="Option 2"> Option 2</input>
<input type="radio" id="opt3" name="group1" value="Option 3"> Option 3</input>
</pre></p><p>You can select an option in either of two ways:</p><p><pre class="stHighlighted">
radioButtonGroup(<span class="stQuotedString">"group1"</span>).value = <span class="stQuotedString">"Option 2"</span>
radioButtonGroup(<span class="stQuotedString">"group1"</span>).selection = <span class="stType">Some</span>(<span class="stQuotedString">"Option 2"</span>)
</pre></p><p>Likewise, you can read the currently selected value of a group of radio buttons in two ways:</p><p><pre class="stHighlighted">
radioButtonGroup(<span class="stQuotedString">"group1"</span>).value should be (<span class="stQuotedString">"Option 2"</span>)
radioButtonGroup(<span class="stQuotedString">"group1"</span>).selection should be (<span class="stType">Some</span>(<span class="stQuotedString">"Option 2"</span>))
</pre></p><p>If the radio button has no selection at all, <code>selection</code> will return <code>None</code> whereas <code>value</code>
will throw a <code>TestFailedException</code>. By using <code>value</code>, you are indicating you expect a selection, and if there
isn't a selection that should result in a failed test.</p><p>If you would like to work with <code>RadioButton</code> element directly, you can select it by calling <code>radioButton</code>:</p><p><pre class="stHighlighted">
click on radioButton(<span class="stQuotedString">"opt1"</span>)
</pre></p><p>you can check if an option is selected by calling <code>isSelected</code>:</p><p><pre class="stHighlighted">
radioButton(<span class="stQuotedString">"opt1"</span>).isSelected should be (<span class="stReserved">true</span>)
</pre></p><p>to get the value of radio button, you can call <code>value</code>:</p><p><pre class="stHighlighted">
radioButton(<span class="stQuotedString">"opt1"</span>).value should be (<span class="stQuotedString">"Option 1"</span>)
</pre></p><h5> Checkboxes </h5><p>A checkbox in one of two states: selected or cleared. Here's how you select a checkbox:</p><p><pre class="stHighlighted">
checkbox(<span class="stQuotedString">"cbx1"</span>).select()
</pre></p><p>And here's how you'd clear one:</p><p><pre class="stHighlighted">
checkbox(<span class="stQuotedString">"cbx1"</span>).clear()
</pre></p><p>You can access the current state of a checkbox with <code>isSelected</code>:</p><p><pre class="stHighlighted">
checkbox(<span class="stQuotedString">"cbx1"</span>).isSelected should be (<span class="stReserved">true</span>)
</pre></p><h5> Single-selection dropdown lists </h5><p>Given the following single-selection dropdown list:</p><p><pre>
<select id="select1">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
</pre></p><p>You could select <code>Option 2</code> in either of two ways:</p><p><pre class="stHighlighted">
singleSel(<span class="stQuotedString">"select1"</span>).value = <span class="stQuotedString">"option2"</span>
singleSel(<span class="stQuotedString">"select1"</span>).selection = <span class="stType">Some</span>(<span class="stQuotedString">"option2"</span>)
</pre></p><p>To clear the selection, either invoke <code>clear</code> or set <code>selection</code> to <code>None</code>:</p><p><pre class="stHighlighted">
singleSel(<span class="stQuotedString">"select1"</span>).clear()
singleSel(<span class="stQuotedString">"select1"</span>).selection = <span class="stType">None</span>
</pre></p><p>You can read the currently selected value of a single-selection list in the same manner as radio buttons:</p><p><pre class="stHighlighted">
singleSel(<span class="stQuotedString">"select1"</span>).value should be (<span class="stQuotedString">"option2"</span>)
singleSel(<span class="stQuotedString">"select1"</span>).selection should be (<span class="stType">Some</span>(<span class="stQuotedString">"option2"</span>))
</pre></p><p>If the single-selection list has no selection at all, <code>selection</code> will return <code>None</code> whereas <code>value</code>
will throw a <code>TestFailedException</code>. By using <code>value</code>, you are indicating you expect a selection, and if there
isn't a selection that should result in a failed test.</p><h5> Multiple-selection lists </h5><p>Given the following multiple-selection list:</p><p><pre>
<select name="select2" multiple="multiple">
<option value="option4">Option 4</option>
<option value="option5">Option 5</option>
<option value="option6">Option 6</option>
</select>
</pre></p><p>You could select <code>Option 5</code> and <code>Option 6</code> like this:</p><p><pre class="stHighlighted">
multiSel(<span class="stQuotedString">"select2"</span>).values = <span class="stType">Seq</span>(<span class="stQuotedString">"option5"</span>, <span class="stQuotedString">"option6"</span>)
</pre></p><p>The previous command would essentially clear all selections first, then select <code>Option 5</code> and <code>Option 6</code>.
If instead you want to <em>not</em> clear any existing selection, just additionally select <code>Option 5</code> and <code>Option 6</code>,
you can use the <code>+=</code> operator, like this.</p><p><pre class="stHighlighted">
multiSel(<span class="stQuotedString">"select2"</span>).values += <span class="stQuotedString">"option5"</span>
multiSel(<span class="stQuotedString">"select2"</span>).values += <span class="stQuotedString">"option6"</span>
</pre></p><p>To clear a specific option, pass its name to <code>clear</code>:</p><p><pre class="stHighlighted">
multiSel(<span class="stQuotedString">"select2"</span>).clear(<span class="stQuotedString">"option5"</span>)
</pre></p><p>To clear all selections, call <code>clearAll</code>:</p><p><pre class="stHighlighted">
multiSel(<span class="stQuotedString">"select2"</span>).clearAll()
</pre></p><p>You can access the current selections with <code>values</code>, which returns an immutable <code>IndexedSeq[String]</code>:</p><p><pre class="stHighlighted">
multiSel(<span class="stQuotedString">"select2"</span>).values should have size <span class="stLiteral">2</span>
multiSel(<span class="stQuotedString">"select2"</span>).values(<span class="stLiteral">0</span>) should be (<span class="stQuotedString">"option5"</span>)
multiSel(<span class="stQuotedString">"select2"</span>).values(<span class="stLiteral">1</span>) should be (<span class="stQuotedString">"option6"</span>)
</pre></p><h5> Clicking and submitting </h5><p>You can click on any element with “<code>click on</code>” as shown previously:</p><p><pre class="stHighlighted">
click on <span class="stQuotedString">"aButton"</span>
click on name(<span class="stQuotedString">"aTextField"</span>)
</pre></p><p>If the requested element is not found, <code>click on</code> will throw an exception, failing the test.</p><p>Clicking on a input element will give it the focus. If current focus is in on an input element within a form, you can submit the form by
calling <code>submit</code>:</p><p><pre class="stHighlighted">
submit()
</pre></p><h4> Switching </h4><p>You can switch to a popup alert bo using the following code:</p><p><pre class="stHighlighted">
switch to alertBox
</pre></p><p>to switch to a frame, you could:</p><p><pre class="stHighlighted">
switch to frame(<span class="stLiteral">0</span>) <span class="stLineComment">// switch by index</span>
switch to frame(<span class="stQuotedString">"name"</span>) <span class="stLineComment">// switch by name</span>
</pre></p><p>If you have reference to a window handle (can be obtained from calling windowHandle/windowHandles), you can switch to a particular
window by:</p><p><pre class="stHighlighted">
switch to window(windowHandle)
</pre></p><p>You can also switch to active element and default content:</p><p><pre class="stHighlighted">
switch to activeElement
switch to defaultContent
</pre></p><h4> Navigation history </h4><p>In real web browser, you can press the 'Back' button to go back to previous page. To emulate that action in your test, you can call <code>goBack</code>:</p><p><pre class="stHighlighted">
goBack()
</pre></p><p>To emulate the 'Forward' button, you can call:</p><p><pre class="stHighlighted">
goForward()
</pre></p><p>And to refresh or reload the current page, you can call:</p><p><pre class="stHighlighted">
reloadPage()
</pre></p><h4> Cookies! </h4><p>To create a new cookie, you'll say:</p><p><pre class="stHighlighted">
add cookie (<span class="stQuotedString">"cookie_name"</span>, <span class="stQuotedString">"cookie_value"</span>)
</pre></p><p>to read a cookie value, you do:</p><p><pre class="stHighlighted">
cookie(<span class="stQuotedString">"cookie_name"</span>).value should be (<span class="stQuotedString">"cookie_value"</span>) <span class="stLineComment">// If value is undefined, throws TFE right then and there. Never returns null.</span>
</pre></p><p>In addition to the common use of name-value cookie, you can pass these extra fields when creating the cookie, available ways are:</p><p><pre class="stHighlighted">
cookie(name: <span class="stType">String</span>, value: <span class="stType">String</span>)
cookie(name: <span class="stType">String</span>, value: <span class="stType">String</span>, path: <span class="stType">String</span>)
cookie(name: <span class="stType">String</span>, value: <span class="stType">String</span>, path: <span class="stType">String</span>, expiry: <span class="stType">Date</span>)
cookie(name: <span class="stType">String</span>, value: <span class="stType">String</span>, path: <span class="stType">String</span>, expiry: <span class="stType">Date</span>, domain: <span class="stType">String</span>)
cookie(name: <span class="stType">String</span>, value: <span class="stType">String</span>, path: <span class="stType">String</span>, expiry: <span class="stType">Date</span>, domain: <span class="stType">String</span>, secure: <span class="stType">Boolean</span>)
</pre></p><p>and to read those extra fields:</p><p><pre class="stHighlighted">
cookie(<span class="stQuotedString">"cookie_name"</span>).value <span class="stLineComment">// Read cookie's value</span>
cookie(<span class="stQuotedString">"cookie_name"</span>).path <span class="stLineComment">// Read cookie's path</span>
cookie(<span class="stQuotedString">"cookie_name"</span>).expiry <span class="stLineComment">// Read cookie's expiry</span>
cookie(<span class="stQuotedString">"cookie_name"</span>).domain <span class="stLineComment">// Read cookie's domain</span>
cookie(<span class="stQuotedString">"cookie_name"</span>).isSecure <span class="stLineComment">// Read cookie's isSecure flag</span>
</pre></p><p>In order to delete a cookie, you could use the following code:</p><p><pre class="stHighlighted">
delete cookie <span class="stQuotedString">"cookie_name"</span>
</pre></p><p>or to delete all cookies in the same domain:-</p><p><pre class="stHighlighted">
delete all cookies
</pre></p><p>To get the underlying Selenium cookie, you can use <code>underlying</code>:</p><p><pre class="stHighlighted">
cookie(<span class="stQuotedString">"cookie_name"</span>).underlying.validate() <span class="stLineComment">// call the validate() method on underlying Selenium cookie</span>
</pre></p><h4> Other useful element properties </h4><p>All element types (<code>textField</code>, <code>textArea</code>, <code>radioButton</code>, <code>checkbox</code>, <code>singleSel</code>, <code>multiSel</code>)
support the following useful properties:</p><p><table style="border-collapse: collapse; border: 1px solid black">
<tr><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong>Method</strong></th><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong>Description</strong></th></tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>location</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
The XY location of the top-left corner of this <code>Element</code>.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>size</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
The width/height size of this <code>Element</code>.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>isDisplayed</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
Indicates whether this <code>Element</code> is displayed.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>isEnabled</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
Indicates whether this <code>Element</code> is enabled.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>isSelected</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
Indicates whether this <code>Element</code> is selected.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>tagName</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
The tag name of this element.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>underlying</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
The underlying <code>WebElement</code> wrapped by this <code>Element</code>.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>attribute(name: String)</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
The attribute value of the given attribute name of this element, wrapped in a <code>Some</code>, or <code>None</code> if no
such attribute exists on this <code>Element</code>.
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>text</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
Returns the visible (<em>i.e.</em>, not hidden by CSS) text of this element, including sub-elements, without any leading or trailing whitespace.
</td>
</tr>
</table></p><h4> Implicit wait </h4><p>To set Selenium's implicit wait timeout, you can call the <code>implicitlyWait</code> method:</p><p><pre class="stHighlighted">
implicitlyWait(<span class="stType">Span</span>(<span class="stLiteral">10</span>, <span class="stType">Seconds</span>))
</pre></p><p>Invoking this method sets the amount of time the driver will wait when searching for an element that is not immediately present. For
more information, see the documentation for method <code>implicitlyWait</code>.</p><h4> Page source and current URL </h4><p>It is possible to get the html source of currently loaded page, using:</p><p><pre class="stHighlighted">
pageSource
</pre></p><p>and if needed, get the current URL of currently loaded page:</p><p><pre class="stHighlighted">
currentUrl
</pre></p><h4> Screen capture </h4><p>You can capture screen using the following code:</p><p><pre class="stHighlighted">
<span class="stReserved">val</span> file = capture
</pre></p><p>By default, the captured image file will be saved in temporary folder (returned by java.io.tmpdir property), with random file name
ends with .png extension. You can specify a fixed file name:</p><p><pre class="stHighlighted">
capture to <span class="stQuotedString">"MyScreenShot.png"</span>
</pre></p><p>or</p><p><pre class="stHighlighted">
capture to <span class="stQuotedString">"MyScreenShot"</span>
</pre></p><p>Both will result in a same file name <code>MyScreenShot.png</code>.</p><p>You can also change the target folder screenshot file is written to, by saying:</p><p><pre class="stHighlighted">
setCaptureDir(<span class="stQuotedString">"/home/your_name/screenshots"</span>)
</pre></p><p>If you want to capture a screenshot when something goes wrong (e.g. test failed), you can use <code>withScreenshot</code>:</p><p><pre class="stHighlighted">
withScreenshot {
assert(<span class="stQuotedString">"Gold"</span> == <span class="stQuotedString">"Silver"</span>, <span class="stQuotedString">"Expected gold, but got silver"</span>)
}
</pre></p><p>In case the test code fails, you'll see the screenshot location appended to the error message, for example:</p><p><pre>
Expected gold but got silver; screenshot capture in /tmp/AbCdEfGhIj.png
</pre></p><p><a name="pageObjects"></a></p><h4> Using the page object pattern </h4><p>If you use the page object pattern, mixing trait <code>Page</code> into your page classes will allow you to use the <code>go to</code>
syntax with your page objects. Here's an example:</p><p><pre class="stHighlighted">
<span class="stReserved">class</span> <span class="stType">HomePage</span> <span class="stReserved">extends</span> <span class="stType">Page</span> {
<span class="stReserved">val</span> url = <span class="stQuotedString">"http://localhost:9000/index.html"</span>
}
<br/><span class="stReserved">val</span> homePage = <span class="stReserved">new</span> <span class="stType">HomePage</span>
go to homePage
</pre></p><h4> Executing JavaScript </h4><p>To execute arbitrary JavaScript, for example, to test some JavaScript functions on your page, pass it to <code>executeScript</code>:</p><p><pre class="stHighlighted">
go to (host + <span class="stQuotedString">"index.html"</span>)
<span class="stReserved">val</span> result1 = executeScript(<span class="stQuotedString">"return document.title;"</span>)
result1 should be (<span class="stQuotedString">"Test Title"</span>)
<span class="stReserved">val</span> result2 = executeScript(<span class="stQuotedString">"return 'Hello ' + arguments[0]"</span>, <span class="stQuotedString">"ScalaTest"</span>)
result2 should be (<span class="stQuotedString">"Hello ScalaTest"</span>)
</pre></p><p>To execute an asynchronous bit of JavaScript, pass it to <code>executeAsyncScript</code>. You can set the script timeout with <code>setScriptTimeout</code>:</p><p><pre class="stHighlighted">
<span class="stReserved">val</span> script = <span class="stQuotedString">"""</span>
<span class="stQuotedString">var callback = arguments[arguments.length - 1];</span>
<span class="stQuotedString">window.setTimeout(function() {callback('Hello ScalaTest')}, 500);</span>
<span class="stQuotedString">"""</span>
setScriptTimeout(<span class="stLiteral">1</span> second)
<span class="stReserved">val</span> result = executeAsyncScript(script)
result should be (<span class="stQuotedString">"Hello ScalaTest"</span>)
</pre></p><h4> Querying for elements </h4><p>You can query for arbitrary elements via <code>find</code> and <code>findAll</code>. The <code>find</code> method returns the first matching element, wrapped in a <code>Some</code>,
or <code>None</code> if no element is found. The <code>findAll</code> method returns an immutable <code>IndexedSeq</code> of all matching elements. If no elements match the query, <code>findAll</code>
returns an empty <code>IndexedSeq</code>. These methods allow you to perform rich queries using <code>for</code> expressions. Here are some examples:</p><p><pre class="stHighlighted">
<span class="stReserved">val</span> ele: <span class="stType">Option[Element]</span> = find(<span class="stQuotedString">"q"</span>)
<br/><span class="stReserved">val</span> eles: <span class="stType">colection.immutable.IndexedSeq[Element]</span> = findAll(className(<span class="stQuotedString">"small"</span>))
<span class="stReserved">for</span> (e <- eles; <span class="stReserved">if</span> e.tagName != <span class="stQuotedString">"input"</span>)
e should be (<span class="stQuotedString">'displayed</span>)
<span class="stReserved">val</span> textFields = eles filter { tf.isInstanceOf[<span class="stType">TextField</span>] }
</pre></p><h4> Cleaning up </h4><p>To close the current browser window, and exit the driver if the current window was the only one remaining, use <code>close</code>:</p><p><pre class="stHighlighted">
close()
</pre></p><p>To close all windows, and exit the driver, use <code>quit</code>:</p><p><pre class="stHighlighted">
quit()
</pre></p><p><a name="alternateForms"></a></p><h4> Alternate forms </h4><p>Although statements like “<code>delete all cookies</code>” fit well with matcher statements
like “<code>title should be ("Cheese!")</code>”, they do not fit as well
with the simple method call form of assertions. If you prefer, you can avoid operator notation
and instead use alternatives that take the form of plain-old method calls. Here's an example:</p><p><pre class="stHighlighted">
goTo(<span class="stQuotedString">"http://www.google.com"</span>)
clickOn(<span class="stQuotedString">"q"</span>)
textField(<span class="stQuotedString">"q"</span>).value = <span class="stQuotedString">"Cheese!"</span>
submit()
<span class="stLineComment">// Google's search is rendered dynamically with JavaScript.</span>
eventually(assert(pageTitle === <span class="stQuotedString">"Cheese! - Google Search"</span>))
</pre></p><p>Here's a table showing the complete list of alternatives:</p><p><table style="border-collapse: collapse; border: 1px solid black">
<tr><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong>operator notation</strong></th><th style="background-color: #CCCCCC; border-width: 1px; padding: 3px; text-align: center; border: 1px solid black"><strong>method call</strong></th></tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>go to (host + "index.html")</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>goTo(host + "index.html")</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>click on "aButton"</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>clickOn("aButton")</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>switch to activeElement</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>switchTo(activeElement)</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>add cookie ("cookie_name", "cookie_value")</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>addCookie("cookie_name", "cookie_value")</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>delete cookie "cookie_name"</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>deleteCookie("cookie_name")</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>delete all cookies</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>deleteAllCookies()</code>
</td>
</tr>
<tr>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>capture to "MyScreenShot"</code>
</td>
<td style="border-width: 1px; padding: 3px; border: 1px solid black; text-align: left">
<code>captureTo("MyScreenShot")</code>
</td>
</tr>
</table>
</p></div><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="index.html" class="extype" name="org.scalatest.selenium">selenium</a></dd><dt>Annotations</dt><dd>
<span class="name">@deprecated</span>
</dd><dt>Deprecated</dt><dd class="cmt"><p>WebBrowser has been moved from org.scalatest.selenium to org.scalatestplus.selenium. Please update your imports, as this deprecated type alias will be removed in a future version of ScalaTest.</p></dd></dl></div>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$ActiveElementTarget.html" title="This class supports switching to the currently active element in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$ActiveElementTarget.html" title="This class supports switching to the currently active element in ScalaTest's Selenium DSL.">ActiveElementTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$AlertTarget.html" title="This class supports switching to the alert box in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$AlertTarget.html" title="This class supports switching to the alert box in ScalaTest's Selenium DSL.">AlertTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$Checkbox.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$Checkbox.html" title="This class is part of ScalaTest's Selenium DSL.">Checkbox</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$ClassNameQuery.html" title="A class name query."></a>
<a href="WebBrowser$ClassNameQuery.html" title="A class name query.">ClassNameQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$ColorField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$ColorField.html" title="This class is part of ScalaTest's Selenium DSL.">ColorField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$CookiesNoun.html" title="This class is part of the ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$CookiesNoun.html" title="This class is part of the ScalaTest's Selenium DSL.">CookiesNoun</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$CssSelectorQuery.html" title="A CSS selector query."></a>
<a href="WebBrowser$CssSelectorQuery.html" title="A CSS selector query.">CssSelectorQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$DateField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$DateField.html" title="This class is part of ScalaTest's Selenium DSL.">DateField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$DateTimeField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$DateTimeField.html" title="This class is part of ScalaTest's Selenium DSL.">DateTimeField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$DateTimeLocalField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$DateTimeLocalField.html" title="This class is part of ScalaTest's Selenium DSL.">DateTimeLocalField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$DefaultContentTarget.html" title="This class supports switching to the default content in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$DefaultContentTarget.html" title="This class supports switching to the default content in ScalaTest's Selenium DSL.">DefaultContentTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$Dimension.html" title="A dimension containing the width and height of a screen element."></a>
<a href="WebBrowser$Dimension.html" title="A dimension containing the width and height of a screen element.">Dimension</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="trait" href="WebBrowser$Element.html" title="Wrapper class for a Selenium WebElement."></a>
<a href="WebBrowser$Element.html" title="Wrapper class for a Selenium WebElement.">Element</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$EmailField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$EmailField.html" title="This class is part of ScalaTest's Selenium DSL.">EmailField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$FrameElementTarget.html" title="This class supports switching to a frame by element in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$FrameElementTarget.html" title="This class supports switching to a frame by element in ScalaTest's Selenium DSL.">FrameElementTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$FrameIndexTarget.html" title="This class supports switching to a frame by index in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$FrameIndexTarget.html" title="This class supports switching to a frame by index in ScalaTest's Selenium DSL.">FrameIndexTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$FrameNameOrIdTarget.html" title="This class supports switching to a frame by name or ID in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$FrameNameOrIdTarget.html" title="This class supports switching to a frame by name or ID in ScalaTest's Selenium DSL.">FrameNameOrIdTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$FrameWebElementTarget.html" title="This class supports switching to a frame by web element in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$FrameWebElementTarget.html" title="This class supports switching to a frame by web element in ScalaTest's Selenium DSL.">FrameWebElementTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$IdQuery.html" title="An ID query."></a>
<a href="WebBrowser$IdQuery.html" title="An ID query.">IdQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$LinkTextQuery.html" title="A link text query."></a>
<a href="WebBrowser$LinkTextQuery.html" title="A link text query.">LinkTextQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$MonthField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$MonthField.html" title="This class is part of ScalaTest's Selenium DSL.">MonthField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$MultiSel.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$MultiSel.html" title="This class is part of ScalaTest's Selenium DSL.">MultiSel</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$MultiSelOptionSeq.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$MultiSelOptionSeq.html" title="This class is part of ScalaTest's Selenium DSL.">MultiSelOptionSeq</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$NameQuery.html" title="A name query."></a>
<a href="WebBrowser$NameQuery.html" title="A name query.">NameQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$NumberField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$NumberField.html" title="This class is part of ScalaTest's Selenium DSL.">NumberField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$PartialLinkTextQuery.html" title="A partial link text query."></a>
<a href="WebBrowser$PartialLinkTextQuery.html" title="A partial link text query.">PartialLinkTextQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$PasswordField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$PasswordField.html" title="This class is part of ScalaTest's Selenium DSL.">PasswordField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$Point.html" title="A point containing an XY screen location."></a>
<a href="WebBrowser$Point.html" title="A point containing an XY screen location.">Point</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="trait" href="WebBrowser$Query.html" title="This trait is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$Query.html" title="This trait is part of ScalaTest's Selenium DSL.">Query</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="" title="This class is part of ScalaTest's Selenium DSL.">RadioButton</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$RadioButtonGroup.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$RadioButtonGroup.html" title="This class is part of ScalaTest's Selenium DSL.">RadioButtonGroup</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$RangeField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$RangeField.html" title="This class is part of ScalaTest's Selenium DSL.">RangeField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$SearchField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$SearchField.html" title="This class is part of ScalaTest's Selenium DSL.">SearchField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$SingleSel.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$SingleSel.html" title="This class is part of ScalaTest's Selenium DSL.">SingleSel</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$SwitchTarget.html" title="This sealed abstract class supports switching in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$SwitchTarget.html" title="This sealed abstract class supports switching in ScalaTest's Selenium DSL.">SwitchTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$TagNameQuery.html" title="A tag name query."></a>
<a href="WebBrowser$TagNameQuery.html" title="A tag name query.">TagNameQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$TelField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$TelField.html" title="This class is part of ScalaTest's Selenium DSL.">TelField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$TextArea.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$TextArea.html" title="This class is part of ScalaTest's Selenium DSL.">TextArea</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$TextField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$TextField.html" title="This class is part of ScalaTest's Selenium DSL.">TextField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$TimeField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$TimeField.html" title="This class is part of ScalaTest's Selenium DSL.">TimeField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$UrlField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$UrlField.html" title="This class is part of ScalaTest's Selenium DSL.">UrlField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="trait" href="WebBrowser$ValueElement.html" title=""></a>
<a href="WebBrowser$ValueElement.html" title="">ValueElement</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$WeekField.html" title="This class is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$WeekField.html" title="This class is part of ScalaTest's Selenium DSL.">WeekField</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$WindowTarget.html" title="This class supports switching to a window by name or handle in ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$WindowTarget.html" title="This class supports switching to a window by name or handle in ScalaTest's Selenium DSL.">WindowTarget</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$WrappedCookie.html" title="Wrapper class for a Selenium Cookie."></a>
<a href="WebBrowser$WrappedCookie.html" title="Wrapper class for a Selenium Cookie.">WrappedCookie</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="class" href="WebBrowser$XPathQuery.html" title="An XPath query."></a>
<a href="WebBrowser$XPathQuery.html" title="An XPath query.">XPathQuery</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$add$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$add$.html" title="This object is part of ScalaTest's Selenium DSL.">add</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$capture$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$capture$.html" title="This object is part of ScalaTest's Selenium DSL.">capture</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$click$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$click$.html" title="This object is part of ScalaTest's Selenium DSL.">click</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$delete$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$delete$.html" title="This object is part of ScalaTest's Selenium DSL.">delete</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$go$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$go$.html" title="This object is part of ScalaTest's Selenium DSL.">go</a>
</li><li class="current-entities indented4">
<span class="separator"></span>
<a class="object" href="WebBrowser$switch$.html" title="This object is part of ScalaTest's Selenium DSL."></a>
<a href="WebBrowser$switch$.html" title="This object is part of ScalaTest's Selenium DSL.">switch</a>
</li>
</ul>
</div>
</div>
<div id="content">
<body class="class type">
<!-- Top of doc.scalatest.org [javascript] -->
<script type="text/javascript">
var rnd = window.rnd || Math.floor(Math.random()*10e6);
var pid204546 = window.pid204546 || rnd;
var plc204546 = window.plc204546 || 0;
var abkw = window.abkw || '';
var absrc = 'http://ab167933.adbutler-ikon.com/adserve/;ID=167933;size=468x60;setID=204546;type=js;sw='+screen.width+';sh='+screen.height+';spr='+window.devicePixelRatio+';kw='+abkw+';pid='+pid204546+';place='+(plc204546++)+';rnd='+rnd+';click=CLICK_MACRO_PLACEHOLDER';
document.write('<scr'+'ipt src="'+absrc+'" type="text/javascript"></scr'+'ipt>');
</script>
<div id="definition">
<div class="big-circle class">c</div>
<p id="owner"><a href="../../index.html" class="extype" name="org">org</a>.<a href="../index.html" class="extype" name="org.scalatest">scalatest</a>.<a href="index.html" class="extype" name="org.scalatest.selenium">selenium</a>.<a href="WebBrowser.html" class="extype" name="org.scalatest.selenium.WebBrowser">WebBrowser</a></p>
<h1>RadioButton<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html" title="Permalink">
<i class="material-icons"></i>
</a>
</span></h1>
<h3><span class="morelinks"></span></h3>
</div>
<h4 id="signature" class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">class</span>
</span>
<span class="symbol">
<span class="name">RadioButton</span><span class="result"> extends <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></span>
</span>
</h4>
<div id="comment" class="fullcommenttop"><div class="comment cmt"><p>This class is part of ScalaTest's Selenium DSL. Please see the documentation for
<a href="WebBrowser.html"><code>WebBrowser</code></a> for an overview of the Selenium DSL.</p><p>This class enables syntax such as the following:</p><p><pre class="stHighlighted">
radioButton(id(<span class="stQuotedString">"opt1"</span>)).value should be (<span class="stQuotedString">"Option 1!"</span>)
</pre>
</p></div><dl class="attributes block"> <dt>Source</dt><dd><a href="https://github.com/scalatest/scalatest/tree/release-3.0.7/scalatest//src/main/scala/org/scalatest/selenium/WebBrowser.scala" target="_blank">WebBrowser.scala</a></dd><dt>Exceptions thrown</dt><dd><span class="cmt"><p><span class="extype" name="TestFailedExeption"><code>TestFailedExeption</code></span> if the passed <code>WebElement</code> does not represent a text area</p></span></dd></dl><div class="toggleContainer block">
<span class="toggle">
Linear Supertypes
</span>
<div class="superTypes hiddenContent"><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a>, <span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div>
</div></div>
<div id="mbrsel">
<div class="toggle"></div>
<div id="memberfilter">
<i class="material-icons arrow"></i>
<span class="input">
<input id="mbrsel-input" placeholder="Filter all members" type="text" accesskey="/" />
</span>
<i class="clear material-icons"></i>
</div>
<div id="filterby">
<div id="order">
<span class="filtertype">Ordering</span>
<ol>
<li class="alpha in"><span>Alphabetic</span></li>
<li class="inherit out"><span>By Inheritance</span></li>
</ol>
</div>
<div class="ancestors">
<span class="filtertype">Inherited<br />
</span>
<ol id="linearization">
<li class="in" name="org.scalatest.selenium.WebBrowser.RadioButton"><span>RadioButton</span></li><li class="in" name="org.scalatest.selenium.WebBrowser.Element"><span>Element</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li>
</ol>
</div><div class="ancestors">
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
<li class="showall in"><span>Show All</span></li>
</ol>
</div>
<div id="visbl">
<span class="filtertype">Visibility</span>
<ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol>
</div>
</div>
</div>
<div id="template">
<div id="allMembers">
<div id="constructors" class="members">
<h3>Instance Constructors</h3>
<ol><li name="org.scalatest.selenium.WebBrowser.RadioButton#<init>" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="<init>(underlying:org.openqa.selenium.WebElement)(implicitpos:org.scalactic.source.Position):WebBrowser.this.RadioButton"></a><a id="<init>:RadioButton"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#<init>(underlying:org.openqa.selenium.WebElement)(implicitpos:org.scalactic.source.Position):WebBrowser.this.RadioButton" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">new</span>
</span>
<span class="symbol">
<span class="name">RadioButton</span><span class="params">(<span name="underlying">underlying: <span class="extype" name="org.openqa.selenium.WebElement">WebElement</span></span>)</span><span class="params">(<span class="implicit">implicit </span><span name="pos">pos: <span class="extype" name="org.scalactic.source.Position">Position</span></span>)</span>
</span>
<p class="shortcomment cmt"></p><div class="fullcomment"><div class="comment cmt"></div><dl class="paramcmts block"><dt class="param">underlying</dt><dd class="cmt"><p>the <code>WebElement</code> representing a text area</p></dd></dl><dl class="attributes block"> <dt>Exceptions thrown</dt><dd><span class="cmt"><p><span class="extype" name="TestFailedExeption"><code>TestFailedExeption</code></span> if the passed <code>WebElement</code> does not represent a text area</p></span></dd></dl></div>
</li></ol>
</div>
<div class="values members">
<h3>Value Members</h3>
<ol>
<li name="scala.AnyRef#!=" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:Any):Boolean"></a><a id="!=(Any):Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#!=(x$1:Any):Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef###" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="##():Int"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html###():Int" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#==" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:Any):Boolean"></a><a id="==(Any):Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#==(x$1:Any):Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.Any#asInstanceOf" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="asInstanceOf[T0]:T0"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#asInstanceOf[T0]:T0" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#attribute" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="attribute(name:String):Option[String]"></a><a id="attribute(String):Option[String]"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#attribute(name:String):Option[String]" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">attribute</span><span class="params">(<span name="name">name: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Option">Option</span>[<span class="extype" name="scala.Predef.String">String</span>]</span>
</span>
<p class="shortcomment cmt">The attribute value of the given attribute name of this element, wrapped in a <code>Some</code>, or <code>None</code> if no
such attribute exists on this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The attribute value of the given attribute name of this element, wrapped in a <code>Some</code>, or <code>None</code> if no
such attribute exists on this <code>Element</code>.</p><p>This method invokes <code>getAttribute</code> on the underlying <code>WebElement</code>, passing in the
specified <code>name</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the attribute with the given name, wrapped in a <code>Some</code>, else <code>None</code></p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.AnyRef#clone" visbl="prt" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="clone():Object"></a><a id="clone():AnyRef"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#clone():Object" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../../java/lang/index.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@native</span><span class="args">()</span>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.CloneNotSupportedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#eq" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="eq(x$1:AnyRef):Boolean"></a><a id="eq(AnyRef):Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#eq(x$1:AnyRef):Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#equals" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="equals(other:Any):Boolean"></a><a id="equals(Any):Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#equals(other:Any):Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">equals</span><span class="params">(<span name="other">other: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<p class="shortcomment cmt">Returns the result of invoking <code>equals</code> on the underlying <code>Element</code>, passing
in the specified <code>other</code> object.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>equals</code> on the underlying <code>Element</code>, passing
in the specified <code>other</code> object.
</p></div><dl class="paramcmts block"><dt class="param">other</dt><dd class="cmt"><p>the object with which to compare for equality</p></dd><dt>returns</dt><dd class="cmt"><p>true if the passed object is equal to this one</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#finalize" visbl="prt" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="finalize():Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#finalize():Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../../java/lang/index.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="symbol">classOf[java.lang.Throwable]</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#getClass" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getClass():Class[_]"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#getClass():Class[_]" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd><dt>Annotations</dt><dd>
<span class="name">@native</span><span class="args">()</span>
</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#hashCode" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#hashCode():Int" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
<p class="shortcomment cmt">Returns the result of invoking <code>hashCode</code> on the underlying <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>hashCode</code> on the underlying <code>Element</code>.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>a hash code for this object</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isDisplayed" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isDisplayed:Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#isDisplayed:Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isDisplayed</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is displayed.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is displayed.</p><p>This invokes <code>isDisplayed</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently displayed</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isEnabled" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isEnabled:Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#isEnabled:Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isEnabled</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is enabled.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is enabled.</p><p>This invokes <code>isEnabled</code> on the underlying <code>WebElement</code>, which
will generally return <code>true</code> for everything but disabled input elements.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently enabled</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.Any#isInstanceOf" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isInstanceOf[T0]:Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#isInstanceOf[T0]:Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isSelected" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isSelected:Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#isSelected:Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isSelected</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is selected.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is selected.</p><p>This method, which invokes <code>isSelected</code> on the underlying <code>WebElement</code>,
is relevant only for input elements such as checkboxes, options in a single- or multiple-selection
list box, and radio buttons. For any other element it will simply return <code>false</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently selected or checked</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#location" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="location:WebBrowser.this.Point"></a><a id="location:Point"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#location:WebBrowser.this.Point" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">location</span><span class="result">: <a href="WebBrowser$Point.html" class="extype" name="org.scalatest.selenium.WebBrowser.Point">Point</a></span>
</span>
<p class="shortcomment cmt">The XY location of the top-left corner of this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The XY location of the top-left corner of this <code>Element</code>.</p><p>This invokes <code>getLocation</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the location of the top-left corner of this element on the page</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.AnyRef#ne" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ne(x$1:AnyRef):Boolean"></a><a id="ne(AnyRef):Boolean"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#ne(x$1:AnyRef):Boolean" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notify" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notify():Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#notify():Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@native</span><span class="args">()</span>
</dd></dl></div>
</li><li name="scala.AnyRef#notifyAll" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notifyAll():Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#notifyAll():Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@native</span><span class="args">()</span>
</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#size" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="size:WebBrowser.this.Dimension"></a><a id="size:Dimension"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#size:WebBrowser.this.Dimension" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">size</span><span class="result">: <a href="WebBrowser$Dimension.html" class="extype" name="org.scalatest.selenium.WebBrowser.Dimension">Dimension</a></span>
</span>
<p class="shortcomment cmt">The width/height size of this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The width/height size of this <code>Element</code>.</p><p>This invokes <code>getSize</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the size of the element on the page</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.AnyRef#synchronized" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="synchronized[T0](x$1:=>T0):T0"></a><a id="synchronized[T0](⇒T0):T0"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#synchronized[T0](x$1:=>T0):T0" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#tagName" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="tagName:String"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#tagName:String" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">tagName</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
<p class="shortcomment cmt">The tag name of this element.</p><div class="fullcomment"><div class="comment cmt"><p>The tag name of this element.</p><p>This method invokes <code>getTagName</code> on the underlying <code>WebElement</code>.
Note it returns the name of the tag, not the value of the of the <code>name</code> attribute.
For example, it will return will return <code>"input"</code> for the element
<code><input name="city" /></code>, not <code>"city"</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the tag name of this element</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#text" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="text:String"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#text:String" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">text</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
<p class="shortcomment cmt">Returns the visible (<em>i.e.</em>, not hidden by CSS) text of this element, including sub-elements, without any leading or trailing whitespace.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the visible (<em>i.e.</em>, not hidden by CSS) text of this element, including sub-elements, without any leading or trailing whitespace.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the visible text enclosed by this element, or an empty string, if the element encloses no visible text</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#toString" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="toString():String"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#toString():String" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
<p class="shortcomment cmt">Returns the result of invoking <code>toString</code> on the underlying <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>toString</code> on the underlying <code>Element</code>.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>a string representation of this object</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.RadioButton#underlying" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="underlying:org.openqa.selenium.WebElement"></a><a id="underlying:WebElement"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#underlying:org.openqa.selenium.WebElement" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">val</span>
</span>
<span class="symbol">
<span class="name">underlying</span><span class="result">: <span class="extype" name="org.openqa.selenium.WebElement">WebElement</span></span>
</span>
<p class="shortcomment cmt">The underlying <code>WebElement</code> wrapped by this <code>Element</code>
</p><div class="fullcomment"><div class="comment cmt"><p>The underlying <code>WebElement</code> wrapped by this <code>Element</code>
</p></div><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="" class="extype" name="org.scalatest.selenium.WebBrowser.RadioButton">RadioButton</a> → <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.RadioButton#value" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="value:String"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#value:String" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">value</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
<p class="shortcomment cmt">Gets this radio button's value.</p><div class="fullcomment"><div class="comment cmt"><p>Gets this radio button's value.</p><p>Invokes <code>getAttribute("value")</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the radio button's value</p></dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait():Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#wait():Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long,x$2:Int):Unit"></a><a id="wait(Long,Int):Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#wait(x$1:Long,x$2:Int):Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" class="indented0 " data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long):Unit"></a><a id="wait(Long):Unit"></a>
<span class="permalink">
<a href="../../../org/scalatest/selenium/WebBrowser$RadioButton.html#wait(x$1:Long):Unit" title="Permalink">
<i class="material-icons"></i>
</a>
</span>
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@native</span><span class="args">()</span>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li>
</ol>
</div>
</div>
<div id="inheritedMembers">
<div class="parent" name="org.scalatest.selenium.WebBrowser.Element">
<h3>Inherited from <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></h3>
</div><div class="parent" name="scala.AnyRef">
<h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3>
</div><div class="parent" name="scala.Any">
<h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3>
</div>
</div>
<div id="groupedMembers">
<div class="group" name="Ungrouped">
<h3>Ungrouped</h3>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="footer"> </div>
</body>
</div>
</div>
</div>
</body>
</html>
| {
"content_hash": "f0dbc9e48b5e9b3711ffb511a3c58b71",
"timestamp": "",
"source": "github",
"line_count": 1666,
"max_line_length": 650,
"avg_line_length": 68.58163265306122,
"alnum_prop": 0.6451158353536326,
"repo_name": "scalatest/scalatest-website",
"id": "70b395b73f159d6c0d08038ef9e675cd477c6820",
"size": "114363",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/scaladoc/3.0.7/org/scalatest/selenium/WebBrowser$RadioButton.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "8401192"
},
{
"name": "HTML",
"bytes": "4508833233"
},
{
"name": "JavaScript",
"bytes": "12256885"
},
{
"name": "Procfile",
"bytes": "62"
},
{
"name": "Scala",
"bytes": "136544"
}
],
"symlink_target": ""
} |
package cloudformation
import (
"net/url"
"strconv"
)
type BaseParameters struct {
Capabilities []string
Parameters []*StackParameter
StackName string
StackPolicyBody string
StackPolicyURL string
TemplateBody string
TemplateURL string
}
type Values map[string]string
func (values Values) Encode() string {
ret := url.Values{}
for k, v := range values {
if v != "" {
ret.Add(k, v)
}
}
return ret.Encode()
}
func (v Values) updateCapabilities(capabilities []string) {
for i, c := range capabilities {
v["Capabilities.member."+strconv.Itoa(i+1)] = c
}
}
func (v Values) updateParameters(parameters []*StackParameter) {
for i, p := range parameters {
v["Parameters.member."+strconv.Itoa(i+1)+".ParameterKey"] = p.ParameterKey
v["Parameters.member."+strconv.Itoa(i+1)+".ParameterValue"] = p.ParameterValue
}
}
func (c *BaseParameters) values() Values {
v := Values{
"StackPolicyBody": c.StackPolicyBody,
"StackPolicyURL": c.StackPolicyURL,
"TemplateBody": c.TemplateBody,
"TemplateURL": c.TemplateURL,
"StackName": c.StackName,
}
v.updateCapabilities(c.Capabilities)
v.updateParameters(c.Parameters)
return v
}
type CreateStackParameters struct {
BaseParameters
DisableRollback bool
NotificationARNs []string
OnFailure string
Tags []*Tag
TimeoutInMinutes int
}
func (c *CreateStackParameters) values() Values {
v := c.BaseParameters.values()
v["OnFailure"] = c.OnFailure
if c.DisableRollback {
v["DisableRollback"] = "true"
}
if c.TimeoutInMinutes > 0 {
v["TimeoutInMinutes"] = strconv.Itoa(c.TimeoutInMinutes)
}
for i, arn := range c.NotificationARNs {
v["NoNotificationARNs.member."+strconv.Itoa(i+1)] = arn
}
return v
}
type StackParameter struct {
ParameterKey string
ParameterValue string
}
type CreateStackResponse struct {
CreateStackResult *CreateStackResult `xml:"CreateStackResult"`
}
type CreateStackResult struct {
StackId string `xml:"StackId"`
}
func (client *Client) CreateStack(params CreateStackParameters) (stackId string, e error) {
r := &CreateStackResponse{}
v := params.values()
e = client.loadCloudFormationResource("CreateStack", v, r)
if e != nil {
return "", e
}
return r.CreateStackResult.StackId, nil
}
| {
"content_hash": "eaf8c4bf09e14341c694b72f4451c949",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 91,
"avg_line_length": 22.106796116504853,
"alnum_prop": 0.7044356609574001,
"repo_name": "dynport/dgtk",
"id": "0d2d520ceebf9a262f8dbe5a8299791202f197cb",
"size": "2277",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wunderproxy/wunderproxy/Godeps/_workspace/src/github.com/dynport/gocloud/aws/cloudformation/create_stack.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "73"
},
{
"name": "Dockerfile",
"bytes": "491"
},
{
"name": "Go",
"bytes": "649900"
},
{
"name": "HTML",
"bytes": "544834"
},
{
"name": "JavaScript",
"bytes": "2323"
},
{
"name": "Makefile",
"bytes": "3306"
},
{
"name": "Shell",
"bytes": "2381"
},
{
"name": "Smarty",
"bytes": "140"
}
],
"symlink_target": ""
} |
package com.crispeh.apicore.arena;
/**
* Created by Joey on 3/3/2015.
*/
public class GArenaException extends Exception {
/**
* Custom exception for the GArenaManager class.
*
*
* @param s Prints out the error into the provided console.
*/
public GArenaException(String s) {
super(s);
}
}
| {
"content_hash": "c05e274ccfca3c00d67ab518801a5b75",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 63,
"avg_line_length": 18.833333333333332,
"alnum_prop": 0.6194690265486725,
"repo_name": "Crispeh/API",
"id": "e51253dd4a1615a0141abc8fe2526330b524531a",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "APICore/src/main/java/com/crispeh/apicore/arena/GArenaException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "45972"
}
],
"symlink_target": ""
} |
package com.mapzen.places.api.internal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_ADDRESS;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_CITIES;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_ESTABLISHMENT;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_GEOCODE;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_NONE;
import static com.mapzen.places.api.AutocompleteFilter.TYPE_FILTER_REGIONS;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_ADDRESS;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_BOROUGH;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_COARSE;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_COUNTRY;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_COUNTY;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_LOCALITY;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_LOCAL_ADMIN;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_MACRO_COUNTY;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_NEIGHBOURHOOD;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_NONE;
import static com.mapzen.places.api.internal.PeliasLayerConsts.PELIAS_LAYER_VENUE;
/**
* Maps internal filter values to {@link com.mapzen.places.api.AutocompleteFilter} values for the
* {@link PlaceAutocompletePresenter}.
*/
public class PeliasFilterMapper implements FilterMapper {
private static final Map<Integer, String> MAPZEN_PLACES_TO_PELIAS_FILTERS;
static {
MAPZEN_PLACES_TO_PELIAS_FILTERS = new HashMap();
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_ADDRESS, PELIAS_LAYER_ADDRESS);
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_CITIES, PELIAS_LAYER_LOCALITY);
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_ESTABLISHMENT, PELIAS_LAYER_VENUE);
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_GEOCODE, PELIAS_LAYER_COARSE);
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_NONE, PELIAS_LAYER_NONE);
List<String> regionFilters = new ArrayList<String>() { {
add(PELIAS_LAYER_COUNTRY);
add(PELIAS_LAYER_MACRO_COUNTY);
add(PELIAS_LAYER_LOCALITY);
add(PELIAS_LAYER_COUNTY);
add(PELIAS_LAYER_LOCAL_ADMIN);
add(PELIAS_LAYER_BOROUGH);
add(PELIAS_LAYER_NEIGHBOURHOOD);
} };
String peliasRegionFilters = buildCommaSeparated(regionFilters);
MAPZEN_PLACES_TO_PELIAS_FILTERS.put(TYPE_FILTER_REGIONS, peliasRegionFilters);
}
@Override public String getInternalFilter(int autocompleteFilter) {
return MAPZEN_PLACES_TO_PELIAS_FILTERS.get(autocompleteFilter);
}
private static String buildCommaSeparated(List<String> strings) {
StringBuilder builder = new StringBuilder(strings.size() * 2 - 1);
for (int i = 0; i < strings.size() - 2; i++) {
builder.append(strings.get(i));
builder.append(",");
}
builder.append(strings.get(strings.size() - 1));
return builder.toString();
}
}
| {
"content_hash": "9c62d907700a56dd0fbf896a7b980aa7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 97,
"avg_line_length": 49.59090909090909,
"alnum_prop": 0.7803238619003972,
"repo_name": "mapzen/android",
"id": "467def41fd559482a3c00f9b68914481d53e0255",
"size": "3273",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mapzen-places-api/src/main/java/com/mapzen/places/api/internal/PeliasFilterMapper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "534748"
},
{
"name": "Shell",
"bytes": "5715"
}
],
"symlink_target": ""
} |
import numpy as np
from numpy.testing import assert_allclose
import pandas as pd
import pytest
import statsmodels.datasets
from statsmodels.tsa.ar_model import AutoReg
from statsmodels.tsa.arima.model import ARIMA
from statsmodels.tsa.base.prediction import PredictionResults
from statsmodels.tsa.deterministic import Fourier
from statsmodels.tsa.exponential_smoothing.ets import ETSModel
from statsmodels.tsa.forecasting.stl import STLForecast
from statsmodels.tsa.seasonal import STL, DecomposeResult
from statsmodels.tsa.statespace.exponential_smoothing import (
ExponentialSmoothing,
)
@pytest.fixture(scope="module")
def data(request):
rs = np.random.RandomState(987654321)
err = rs.standard_normal(500)
index = pd.date_range("1980-1-1", freq="M", periods=500)
fourier = Fourier(12, 1)
terms = fourier.in_sample(index)
det = np.squeeze(np.asarray(terms @ np.array([[2], [1]])))
for i in range(1, 500):
err[i] += 0.9 * err[i - 1] + det[i]
return pd.Series(err, index=index)
def test_smoke(data):
stlf = STLForecast(data, ARIMA, model_kwargs={"order": (2, 0, 0)})
res = stlf.fit(fit_kwargs={})
res.forecast(37)
assert isinstance(res.summary().as_text(), str)
assert isinstance(res.stl, STL)
assert isinstance(res.result, DecomposeResult)
assert isinstance(res.model, ARIMA)
assert hasattr(res.model_result, "forecast")
MODELS = [
(ARIMA, {"order": (2, 0, 0), "trend": "c"}),
(ExponentialSmoothing, {"trend": True}),
(AutoReg, {"lags": 2, "old_names": False}),
(ETSModel, {}),
]
MODELS = MODELS[-1:]
IDS = [str(c[0]).split(".")[-1][:-2] for c in MODELS]
@pytest.mark.parametrize("config", MODELS, ids=IDS)
@pytest.mark.parametrize("horizon", [1, 7, 23])
def test_equivalence_forecast(data, config, horizon):
model, kwargs = config
stl = STL(data)
stl_fit = stl.fit()
resids = data - stl_fit.seasonal
mod = model(resids, **kwargs)
fit_kwarg = {}
if model is ETSModel:
fit_kwarg["disp"] = False
res = mod.fit(**fit_kwarg)
stlf = STLForecast(data, model, model_kwargs=kwargs).fit(
fit_kwargs=fit_kwarg
)
seasonal = np.asarray(stl_fit.seasonal)[-12:]
seasonal = np.tile(seasonal, 1 + horizon // 12)
fcast = res.forecast(horizon) + seasonal[:horizon]
actual = stlf.forecast(horizon)
assert_allclose(actual, fcast, rtol=1e-4)
if not hasattr(res, "get_prediction"):
return
pred = stlf.get_prediction(data.shape[0], data.shape[0] + horizon - 1)
assert isinstance(pred, PredictionResults)
assert_allclose(pred.predicted_mean, fcast, rtol=1e-4)
half = data.shape[0] // 2
stlf.get_prediction(half, data.shape[0] + horizon - 1)
stlf.get_prediction(half, data.shape[0] + horizon - 1, dynamic=True)
stlf.get_prediction(half, data.shape[0] + horizon - 1, dynamic=half // 2)
if hasattr(data, "index"):
loc = data.index[half + half // 2]
a = stlf.get_prediction(
half, data.shape[0] + horizon - 1, dynamic=loc.strftime("%Y-%m-%d")
)
b = stlf.get_prediction(
half, data.shape[0] + horizon - 1, dynamic=loc.to_pydatetime()
)
c = stlf.get_prediction(half, data.shape[0] + horizon - 1, dynamic=loc)
assert_allclose(a.predicted_mean, b.predicted_mean, rtol=1e-4)
assert_allclose(a.predicted_mean, c.predicted_mean, rtol=1e-4)
def test_exceptions(data):
class BadModel:
def __init__(self, *args, **kwargs):
pass
with pytest.raises(AttributeError, match="model must expose"):
STLForecast(data, BadModel)
class NoForecast(BadModel):
def fit(self, *args, **kwargs):
return BadModel()
with pytest.raises(AttributeError, match="The model's result"):
STLForecast(data, NoForecast).fit()
class BadResult:
def forecast(self, *args, **kwargs):
pass
class FakeModel(BadModel):
def fit(self, *args, **kwargs):
return BadResult()
with pytest.raises(AttributeError, match="The model result does not"):
STLForecast(data, FakeModel).fit().summary()
class BadResultSummary(BadResult):
def summary(self, *args, **kwargs):
return object()
class FakeModelSummary(BadModel):
def fit(self, *args, **kwargs):
return BadResultSummary()
with pytest.raises(TypeError, match="The model result's summary"):
STLForecast(data, FakeModelSummary).fit().summary()
@pytest.fixture(scope="function")
def sunspots():
df = statsmodels.datasets.sunspots.load_pandas().data
df.index = np.arange(df.shape[0])
return df.iloc[:, 0]
def test_get_prediction(sunspots):
# GH7309
stlf_model = STLForecast(
sunspots, model=ARIMA, model_kwargs={"order": (2, 2, 0)}, period=11
)
stlf_res = stlf_model.fit()
pred = stlf_res.get_prediction()
assert pred.predicted_mean.shape == (309,)
assert pred.var_pred_mean.shape == (309,)
@pytest.mark.parametrize("not_implemented", [True, False])
def test_no_var_pred(sunspots, not_implemented):
class DummyPred:
def __init__(self, predicted_mean, row_labels):
self.predicted_mean = predicted_mean
self.row_labels = row_labels
def f():
raise NotImplementedError
if not_implemented:
self.forecast = property(f)
class DummyRes:
def __init__(self, res):
self._res = res
def forecast(self, *args, **kwargs):
return self._res.forecast(*args, **kwargs)
def get_prediction(self, *args, **kwargs):
pred = self._res.get_prediction(*args, **kwargs)
return DummyPred(pred.predicted_mean, pred.row_labels)
class DummyMod:
def __init__(self, y):
self._mod = ARIMA(y)
def fit(self, *args, **kwargs):
res = self._mod.fit(*args, **kwargs)
return DummyRes(res)
stl_mod = STLForecast(sunspots, model=DummyMod, period=11)
stl_res = stl_mod.fit()
pred = stl_res.get_prediction()
assert np.all(np.isnan(pred.var_pred_mean))
| {
"content_hash": "6154d41383d6ee07a082288dd4582752",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 32.57368421052632,
"alnum_prop": 0.63402811439651,
"repo_name": "jseabold/statsmodels",
"id": "3d654dca07da776a2c94fcc079e72d435ca0ce2f",
"size": "6189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "statsmodels/tsa/forecasting/tests/test_stl.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AGS Script",
"bytes": "457842"
},
{
"name": "Assembly",
"bytes": "10509"
},
{
"name": "Batchfile",
"bytes": "351"
},
{
"name": "C",
"bytes": "12088"
},
{
"name": "HTML",
"bytes": "148470"
},
{
"name": "Matlab",
"bytes": "1383"
},
{
"name": "Python",
"bytes": "8609450"
},
{
"name": "R",
"bytes": "34228"
},
{
"name": "Stata",
"bytes": "41179"
}
],
"symlink_target": ""
} |
FOUNDATION_EXPORT double BModuleVersionNumber;
//! Project version string for BModule.
FOUNDATION_EXPORT const unsigned char BModuleVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <BModule/PublicHeader.h>
| {
"content_hash": "b2956f2cf67675ae390e556a34d7f272",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 132,
"avg_line_length": 35.75,
"alnum_prop": 0.8076923076923077,
"repo_name": "pozi119/VOKit",
"id": "838c5bd7c233e116c4b7319815a46d504922ce4b",
"size": "474",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/BModule/BModule/BModule.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "17225"
},
{
"name": "Ruby",
"bytes": "2143"
},
{
"name": "Swift",
"bytes": "185327"
}
],
"symlink_target": ""
} |
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "GPUImageContext.h"
#import "GPUImageOutput.h"
/** Protocol for getting Movie played callback.
*/
@protocol GPUImageMovieDelegate <NSObject>
- (void)didCompletePlayingMovie;
@end
/** Source object for filtering movies
*/
@class GPUImageAudioPlayer;
@interface GPUImageMovie : GPUImageOutput
@property (nonatomic, strong) GPUImageAudioPlayer *audioPlayer;
@property (readwrite, retain) AVAsset *asset;
@property (readwrite, retain) AVPlayerItem *playerItem;
@property(readwrite, retain) NSURL *url;
/** This enables the benchmarking mode, which logs out instantaneous and average frame times to the console
*/
@property(readwrite, nonatomic) BOOL runBenchmark;
/** This determines whether to play back a movie as fast as the frames can be processed, or if the original speed of the movie should be respected. Defaults to NO.
*/
@property(readwrite, nonatomic) BOOL playAtActualSpeed;
/** This determines whether the video should repeat (loop) at the end and restart from the beginning. Defaults to NO.
*/
@property(readwrite, nonatomic) BOOL shouldRepeat;
/** This specifies the progress of the process on a scale from 0 to 1.0. A value of 0 means the process has not yet begun, A value of 1.0 means the conversaion is complete.
This property is not key-value observable.
*/
@property(readonly, nonatomic) float progress;
/** This determines whether audio should be played. Cann't be set to work with video writing. Defaults to NO.
*/
@property(readwrite, nonatomic) BOOL playSound;
/** This is used to send the delete Movie did complete playing alert
*/
@property (readwrite, nonatomic, assign) id <GPUImageMovieDelegate>delegate;
@property (readonly, nonatomic) AVAssetReader *assetReader;
@property (readonly, nonatomic) BOOL audioEncodingIsFinished;
@property (readonly, nonatomic) BOOL videoEncodingIsFinished;
/// @name Initialization and teardown
- (id)initWithAsset:(AVAsset *)asset;
- (id)initWithPlayerItem:(AVPlayerItem *)playerItem;
- (id)initWithURL:(NSURL *)url;
- (void)yuvConversionSetup;
/// @name Movie processing
- (void)enableSynchronizedEncodingUsingMovieWriter:(GPUImageMovieWriter *)movieWriter;
- (BOOL)readNextVideoFrameFromOutput:(AVAssetReaderOutput *)readerVideoTrackOutput;
- (BOOL)readNextAudioSampleFromOutput:(AVAssetReaderOutput *)readerAudioTrackOutput;
- (void)startProcessing;
- (void)endProcessing;
- (void)cancelProcessing;
- (void)processMovieFrame:(CMSampleBufferRef)movieSampleBuffer;
@end
| {
"content_hash": "4195305c0ded962010a3363874937243",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 172,
"avg_line_length": 37.865671641791046,
"alnum_prop": 0.783208513992905,
"repo_name": "odyth/GPUImage",
"id": "669e560052b915f1d5c4ad9804d19f25f1fe9e94",
"size": "2537",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "framework/Source/GPUImageMovie.h",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "7048"
},
{
"name": "Objective-C",
"bytes": "1177371"
},
{
"name": "Ruby",
"bytes": "1282"
},
{
"name": "Shell",
"bytes": "1159"
}
],
"symlink_target": ""
} |
import time
import gc
import os
from collections import defaultdict
import numpy as np
import xarray as xr
import pytest
from pyndl import ndl
from pyndl.activation import activation
TEST_ROOT = os.path.join(os.path.pardir, os.path.dirname(__file__))
FILE_PATH_SIMPLE = os.path.join(TEST_ROOT, "resources/event_file_simple.tab.gz")
FILE_PATH_MULTIPLE_CUES = os.path.join(TEST_ROOT, "resources/event_file_multiple_cues.tab.gz")
LAMBDA_ = 1.0
ALPHA = 0.1
BETAS = (0.1, 0.1)
def test_exceptions():
with pytest.raises(ValueError) as e_info:
weights = ndl.dict_ndl(FILE_PATH_SIMPLE, ALPHA, BETAS, remove_duplicates=None)
activation(FILE_PATH_MULTIPLE_CUES, weights)
assert e_info == 'cues or outcomes needs to be unique: cues "a a"; outcomes "A"; use remove_duplicates=True'
with pytest.raises(ValueError) as e_info:
activation(FILE_PATH_MULTIPLE_CUES, "magic")
assert e_info == "Weights other than xarray.DataArray or dicts are not supported."
@pytest.mark.nolinux
def test_activation_matrix():
weights = xr.DataArray(np.array([[0, 1, 0], [1, 0, 0]]),
coords={
'outcomes': ['o1', 'o2'],
'cues': ['c1', 'c2', 'c3']
},
dims=('outcomes', 'cues'))
events = [(['c1', 'c2', 'c3'], []),
(['c1', 'c3'], []),
(['c2'], []),
(['c1', 'c1'], [])]
reference_activations = np.array([[1, 0, 1, 0], [1, 1, 0, 1]])
with pytest.raises(ValueError):
activations = activation(events, weights, n_jobs=1)
activations = activation(events, weights, n_jobs=1, remove_duplicates=True)
activations_mp = activation(events, weights, n_jobs=3, remove_duplicates=True)
assert np.allclose(reference_activations, activations)
assert np.allclose(reference_activations, activations_mp)
@pytest.mark.nolinux
def test_ignore_missing_cues():
weights = xr.DataArray(np.array([[0, 1, 0], [1, 0, 0]]),
coords={
'outcomes': ['o1', 'o2'],
'cues': ['c1', 'c2', 'c3']
},
dims=('outcomes', 'cues'))
events = [(['c1', 'c2', 'c3'], []),
(['c1', 'c3'], []),
(['c2', 'c4'], []),
(['c1', 'c1'], [])]
reference_activations = np.array([[1, 0, 1, 0], [1, 1, 0, 1]])
with pytest.raises(KeyError):
activations = activation(events, weights, n_jobs=1,
remove_duplicates=True)
activations = activation(events, weights, n_jobs=1,
remove_duplicates=True, ignore_missing_cues=True)
activations_mp = activation(events, weights, n_jobs=3,
remove_duplicates=True, ignore_missing_cues=True)
assert np.allclose(reference_activations, activations)
assert np.allclose(reference_activations, activations_mp)
def test_activation_dict():
weights = defaultdict(lambda: defaultdict(float))
weights['o1']['c1'] = 0
weights['o1']['c2'] = 1
weights['o1']['c3'] = 0
weights['o2']['c1'] = 1
weights['o2']['c2'] = 0
weights['o2']['c3'] = 0
events = [(['c1', 'c2', 'c3'], []),
(['c1', 'c3'], []),
(['c2'], []),
(['c1', 'c1'], [])]
reference_activations = {
'o1': [1, 0, 1, 0],
'o2': [1, 1, 0, 1]
}
with pytest.raises(ValueError):
activations = activation(events, weights, n_jobs=1)
activations = activation(events, weights, n_jobs=1, remove_duplicates=True)
for outcome, activation_list in activations.items():
assert np.allclose(reference_activations[outcome], activation_list)
def test_ignore_missing_cues_dict():
weights = defaultdict(lambda: defaultdict(float))
weights['o1']['c1'] = 0
weights['o1']['c2'] = 1
weights['o1']['c3'] = 0
weights['o2']['c1'] = 1
weights['o2']['c2'] = 0
weights['o2']['c3'] = 0
events = [(['c1', 'c2', 'c3'], []),
(['c1', 'c3'], []),
(['c2', 'c4'], []),
(['c1', 'c1'], [])]
reference_activations = {
'o1': [1, 0, 1, 0],
'o2': [1, 1, 0, 1]
}
with pytest.raises(ValueError):
activations = activation(events, weights, n_jobs=1)
activations = activation(events, weights, n_jobs=1,
remove_duplicates=True, ignore_missing_cues=True)
for outcome, activation_list in activations.items():
assert np.allclose(reference_activations[outcome], activation_list)
@pytest.mark.runslow
def test_activation_matrix_large():
"""
Test with a lot of data. Better run only with at least 12GB free RAM.
To get time prints for single and multiprocessing run with pytest ...
--capture=no --runslow
"""
print("")
print("Start setup...")
def time_test(func, of=""): # pylint: disable=invalid-name
def dec_func(*args, **kwargs):
print(f"start test '{of}'")
start = time.time()
res = func(*args, **kwargs)
end = time.time()
print(f"finished test '{of}'")
print(f" duration: {end - start:.3f}s")
print("")
return res
return dec_func
nn = 2000
n_cues = 10 * nn
n_outcomes = nn
n_events = 10 * nn
n_cues_per_event = 30
weight_mat = np.random.rand(n_outcomes, n_cues)
cues = [f'c{ii}' for ii in range(n_cues)]
weights = xr.DataArray(weight_mat,
coords={'cues': cues},
dims=('outcomes', 'cues'))
events = [(np.random.choice(cues, n_cues_per_event), [])
for _ in range(n_events)] # no generator, we use it twice
print("Start test...")
print("")
gc.collect()
asp = (time_test(activation, of="single threaded")
(events, weights, n_jobs=1, remove_duplicates=True))
gc.collect()
amp = (time_test(activation, of="multi threaded (up to 8 threads)")
(events, weights, n_jobs=8, remove_duplicates=True))
del weights
del events
gc.collect()
print("Compare results...")
assert np.allclose(asp, amp), "single and multi threaded had different results"
print("Equal.")
| {
"content_hash": "31d2d8b09a0185e25d2ddf371ac946dc",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 116,
"avg_line_length": 34.01063829787234,
"alnum_prop": 0.5461370034407257,
"repo_name": "quantling/pyndl",
"id": "0d3caca52833fc937f1cb726562472112c9d659c",
"size": "6443",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "tests/test_activation.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Cython",
"bytes": "33792"
},
{
"name": "Python",
"bytes": "225942"
},
{
"name": "R",
"bytes": "1422"
}
],
"symlink_target": ""
} |
package org.apereo.cas;
import org.apereo.cas.web.security.authentication.MonitorEndpointLdapAuthenticationProviderGroupsBasedTests;
import org.apereo.cas.web.security.authentication.MonitorEndpointLdapAuthenticationProviderRolesBasedTests;
import org.junit.platform.suite.api.SelectClasses;
/**
* This is {@link AllWebflowTestsSuite}.
*
* @author Misagh Moayyed
* @since 5.3.0
*/
@SelectClasses({
WiringConfigurationTests.class,
CasWebflowServerSessionContextConfigurationTests.class,
CasWebflowClientSessionContextConfigurationTests.class,
MonitorEndpointLdapAuthenticationProviderRolesBasedTests.class,
MonitorEndpointLdapAuthenticationProviderGroupsBasedTests.class
})
public class AllWebflowTestsSuite {
}
| {
"content_hash": "561fc053dcc5fff58b92c284b1bab358",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 108,
"avg_line_length": 33.59090909090909,
"alnum_prop": 0.8389715832205683,
"repo_name": "GIP-RECIA/cas",
"id": "d7202c53b812cea7e7344198c80a29537f0352d7",
"size": "739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webapp/cas-server-webapp-config/src/test/java/org/apereo/cas/AllWebflowTestsSuite.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "241392"
},
{
"name": "Dockerfile",
"bytes": "73"
},
{
"name": "Groovy",
"bytes": "10930"
},
{
"name": "HTML",
"bytes": "145773"
},
{
"name": "Java",
"bytes": "10179516"
},
{
"name": "JavaScript",
"bytes": "37158"
},
{
"name": "Ruby",
"bytes": "1323"
},
{
"name": "Shell",
"bytes": "108885"
}
],
"symlink_target": ""
} |
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/luni/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java
//
#include "../../../../J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_JavaNioChannelsSpiAbstractSelectableChannel")
#ifdef RESTRICT_JavaNioChannelsSpiAbstractSelectableChannel
#define INCLUDE_ALL_JavaNioChannelsSpiAbstractSelectableChannel 0
#else
#define INCLUDE_ALL_JavaNioChannelsSpiAbstractSelectableChannel 1
#endif
#undef RESTRICT_JavaNioChannelsSpiAbstractSelectableChannel
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#if !defined (JavaNioChannelsSpiAbstractSelectableChannel_) && (INCLUDE_ALL_JavaNioChannelsSpiAbstractSelectableChannel || defined(INCLUDE_JavaNioChannelsSpiAbstractSelectableChannel))
#define JavaNioChannelsSpiAbstractSelectableChannel_
#define RESTRICT_JavaNioChannelsSelectableChannel 1
#define INCLUDE_JavaNioChannelsSelectableChannel 1
#include "../../../../java/nio/channels/SelectableChannel.h"
@class JavaNioChannelsSelectionKey;
@class JavaNioChannelsSelector;
@class JavaNioChannelsSpiSelectorProvider;
/*!
@brief <code>AbstractSelectableChannel</code> is the base implementation class for
selectable channels.
It declares methods for registering, unregistering and
closing selectable channels. It is thread-safe.
*/
@interface JavaNioChannelsSpiAbstractSelectableChannel : JavaNioChannelsSelectableChannel {
@public
jboolean isBlocking_;
}
#pragma mark Public
/*!
@brief Gets the object used for the synchronization of <code>register</code> and
<code>configureBlocking</code>.
@return the synchronization object.
*/
- (id)blockingLock;
/*!
@brief Sets the blocking mode of this channel.
A call to this method blocks if
other calls to this method or to <code>register</code> are executing. The
actual setting of the mode is done by calling
<code>implConfigureBlocking(boolean)</code>.
- seealso: java.nio.channels.SelectableChannel#configureBlocking(boolean)
@param blockingMode
<code>true</code> for setting this channel's mode to blocking,
<code>false</code> to set it to non-blocking.
@return this channel.
@throws ClosedChannelException
if this channel is closed.
@throws IllegalBlockingModeException
if <code>block</code> is <code>true</code> and this channel has been
registered with at least one selector.
@throws IOException
if an I/O error occurs.
*/
- (JavaNioChannelsSelectableChannel *)configureBlockingWithBoolean:(jboolean)blockingMode;
/*!
@brief Indicates whether this channel is in blocking mode.
@return <code>true</code> if this channel is blocking, <code>false</code>
otherwise.
*/
- (jboolean)isBlocking;
/*!
@brief Indicates whether this channel is registered with one or more selectors.
@return <code>true</code> if this channel is registered with a selector,
<code>false</code> otherwise.
*/
- (jboolean)isRegistered;
/*!
@brief Gets this channel's selection key for the specified selector.
@param selector
the selector with which this channel has been registered.
@return the selection key for the channel or <code>null</code> if this channel
has not been registered with <code>selector</code>.
*/
- (JavaNioChannelsSelectionKey *)keyForWithJavaNioChannelsSelector:(JavaNioChannelsSelector *)selector;
/*!
@brief Returns the selector provider that has created this channel.
- seealso: java.nio.channels.SelectableChannel#provider()
@return this channel's selector provider.
*/
- (JavaNioChannelsSpiSelectorProvider *)provider;
/*!
@brief Registers this channel with the specified selector for the specified
interest set.
If the channel is already registered with the selector, the
<code>interest set</code> is updated to <code>interestSet</code> and
the corresponding selection key is returned. If the channel is not yet
registered, this method calls the <code>register</code> method of
<code>selector</code> and adds the selection key to this channel's key set.
@param selector
the selector with which to register this channel.
@param interestSet
this channel's <code>interest set</code>.
@param attachment
the object to attach, can be <code>null</code>.
@return the selection key for this registration.
@throws CancelledKeyException
if this channel is registered but its key has been canceled.
@throws ClosedChannelException
if this channel is closed.
@throws IllegalArgumentException
if <code>interestSet</code> is not supported by this channel.
@throws IllegalBlockingModeException
if this channel is in blocking mode.
@throws IllegalSelectorException
if this channel does not have the same provider as the given
selector.
*/
- (JavaNioChannelsSelectionKey *)register__WithJavaNioChannelsSelector:(JavaNioChannelsSelector *)selector
withInt:(jint)interestSet
withId:(id)attachment;
#pragma mark Protected
/*!
@brief Constructs a new <code>AbstractSelectableChannel</code>.
@param selectorProvider
the selector provider that creates this channel.
*/
- (instancetype)initWithJavaNioChannelsSpiSelectorProvider:(JavaNioChannelsSpiSelectorProvider *)selectorProvider;
/*!
@brief Implements the channel closing behavior.
Calls
<code>implCloseSelectableChannel()</code> first, then loops through the list
of selection keys and cancels them, which unregisters this channel from
all selectors it is registered with.
@throws IOException
if a problem occurs while closing the channel.
*/
- (void)implCloseChannel;
/*!
@brief Implements the closing function of the SelectableChannel.
This method is
called from <code>implCloseChannel()</code>.
@throws IOException
if an I/O exception occurs.
*/
- (void)implCloseSelectableChannel;
/*!
@brief Implements the configuration of blocking/non-blocking mode.
@param blocking true for blocking, false for non-blocking.
@throws IOException
if an I/O error occurs.
*/
- (void)implConfigureBlockingWithBoolean:(jboolean)blocking;
#pragma mark Package-Private
- (void)deregisterWithJavaNioChannelsSelectionKey:(JavaNioChannelsSelectionKey *)k;
@end
J2OBJC_EMPTY_STATIC_INIT(JavaNioChannelsSpiAbstractSelectableChannel)
FOUNDATION_EXPORT void JavaNioChannelsSpiAbstractSelectableChannel_initWithJavaNioChannelsSpiSelectorProvider_(JavaNioChannelsSpiAbstractSelectableChannel *self, JavaNioChannelsSpiSelectorProvider *selectorProvider);
J2OBJC_TYPE_LITERAL_HEADER(JavaNioChannelsSpiAbstractSelectableChannel)
#endif
#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_JavaNioChannelsSpiAbstractSelectableChannel")
| {
"content_hash": "9aa3a69f0437661f42eefc714e5c5438",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 216,
"avg_line_length": 36.05945945945946,
"alnum_prop": 0.7857892369959526,
"repo_name": "actorapp/J2ObjC-Framework",
"id": "7008cf9b9e287462fd478f42c2f46f00f2af7d01",
"size": "6671",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Scripts/Template/Headers/java/nio/channels/spi/AbstractSelectableChannel.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "44260"
},
{
"name": "Objective-C",
"bytes": "7764379"
},
{
"name": "Python",
"bytes": "2187"
},
{
"name": "Ruby",
"bytes": "812"
},
{
"name": "Shell",
"bytes": "4022"
}
],
"symlink_target": ""
} |
import { expect } from "chai";
import * as Mocks from "../detectors.mock";
import { CanvasDetector } from "../../../../../src/Model/Device/Detectors/Canvas/CanvasDetector";
import { Device } from "../../../../../src/Model/Device/Device";
describe("CanvasDetector", () => {
it("should properly detect canvas properly", (done) => {
let canvasDetector = new CanvasDetector(Mocks.canvasWindowValid);
let device = new Device();
canvasDetector.detect(device);
expect(device.isCanvas).to.be.true;
done();
});
it("should not detect canvas when cannot create canvas HTMLElement", (done) => {
let canvasDetector = new CanvasDetector(Mocks.canvasWindowInvalid);
let device = new Device();
canvasDetector.detect(device);
expect(device.isCanvas).to.be.false;
done();
});
});
| {
"content_hash": "7ec1198fed013060be96cce6a75e359f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 97,
"avg_line_length": 33.23076923076923,
"alnum_prop": 0.6273148148148148,
"repo_name": "webaio/tracker",
"id": "71a9e0b8bfc359145fed29e41559789f8a5195c9",
"size": "922",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Model/Device/Detectors/Canvas/CanvasDetector.test.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6879"
},
{
"name": "TypeScript",
"bytes": "114069"
}
],
"symlink_target": ""
} |
package router
import (
"github.com/Unknwon/macaron"
)
func SetRouters(m *macaron.Macaron) {
}
| {
"content_hash": "6375449bc4a6ea43efcf68a02bd9cab8",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 37,
"avg_line_length": 12.25,
"alnum_prop": 0.7244897959183674,
"repo_name": "yonh/wharf",
"id": "faa563a516a8cf7cf760e3b5c1038cd4c8da1a13",
"size": "98",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Godeps/_workspace/src/github.com/containerops/generator/router/router.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "5765"
},
{
"name": "HTML",
"bytes": "9967"
}
],
"symlink_target": ""
} |
'use strict';
/**
* Makes it possible for invitations to expire by creating an expiry RSVP
*/
// Sequelize doesn't handle updating of enum values. We have to do this manually
function swapEnumTypes(...enumTypes) {
return `
CREATE TYPE "enum_response-rsvps_rsvp-new" AS ENUM(${enumTypes.map(enumType => `'${enumType}'`).join(', ')});
ALTER TABLE "response-rsvps"
ALTER COLUMN rsvp TYPE "enum_response-rsvps_rsvp-new"
USING (rsvp::text::"enum_response-rsvps_rsvp-new");
DROP TYPE "enum_response-rsvps_rsvp";
ALTER TYPE "enum_response-rsvps_rsvp-new" RENAME TO "enum_response-rsvps_rsvp";
`;
}
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.sequelize.query(swapEnumTypes('RSVP_YES', 'RSVP_NO', 'RSVP_EXPIRED'));
},
down: function (queryInterface, Sequelize) {
return queryInterface.sequelize.query(swapEnumTypes('RSVP_YES', 'RSVP_NO'));
}
};
| {
"content_hash": "0c5f1517b201e79aaa30823baa371c84",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 113,
"avg_line_length": 31.2,
"alnum_prop": 0.6891025641025641,
"repo_name": "hackcambridge/hack-cambridge-website",
"id": "633038f782208e66a5b8cec8afe3f4dc8a3380db",
"size": "936",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrations/20170107203437-expiry.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24144"
},
{
"name": "HTML",
"bytes": "76932"
},
{
"name": "JavaScript",
"bytes": "26642"
},
{
"name": "Shell",
"bytes": "963"
},
{
"name": "TypeScript",
"bytes": "142812"
}
],
"symlink_target": ""
} |
package com.twitter.finagle.mdns
import com.twitter.finagle.{Announcer, Announcement, Group, Resolver, Addr}
import com.twitter.util.{Future, FuturePool, Return, Throw, Try, Var}
import java.net.{InetSocketAddress, SocketAddress}
import javax.jmdns._
import scala.collection.mutable
private object DNS {
val dns = JmDNS.create(null, null)
private[this] val pool = FuturePool.unboundedPool
def registerService(info: ServiceInfo) =
pool { dns.registerService(info) }
def unregisterService(info: ServiceInfo) =
pool { dns.unregisterService(info) }
def addServiceListener(regType: String, listener: ServiceListener) =
dns.addServiceListener(regType, listener)
def getServiceInfo(regType: String, name: String) =
pool { dns.getServiceInfo(regType, name) }
}
private class JmDNSAnnouncer extends MDNSAnnouncerIface {
val scheme = "jmdns"
def announce(
addr: InetSocketAddress,
name: String,
regType: String,
domain: String
): Future[Announcement] = {
val info = ServiceInfo.create(regType + "." + domain, name, addr.getPort, "")
DNS.registerService(info) map { _ =>
new Announcement {
def unannounce() = DNS.unregisterService(info) map { _ => () }
}
}
}
}
private object JmDNSResolver {
def resolve(regType: String): Var[Addr] = {
val services = new mutable.HashMap[String, MdnsRecord]()
val v = Var[Addr](Addr.Pending)
DNS.addServiceListener(regType, new ServiceListener {
def serviceResolved(event: ServiceEvent) {}
def serviceAdded(event: ServiceEvent) {
DNS.getServiceInfo(event.getType, event.getName) foreach { info =>
val addresses = info.getInetAddresses
val mdnsRecord = MdnsRecord(
info.getName,
info.getApplication + "." + info.getProtocol,
info.getDomain,
new InetSocketAddress(addresses(0), info.getPort))
synchronized {
services.put(info.getName, mdnsRecord)
v() = Addr.Bound(services.values.toSet: Set[SocketAddress])
}
}
}
def serviceRemoved(event: ServiceEvent) {
synchronized {
if (services.remove(event.getName).isDefined)
v() = Addr.Bound(services.values.toSet: Set[SocketAddress])
}
}
})
v
}
}
private class JmDNSResolver extends MDNSResolverIface {
val scheme = "jmdns"
def resolve(regType: String, domain: String): Var[Addr] =
JmDNSResolver.resolve(regType + "." + domain + ".")
}
private class JmDNSGroup(regType: String) extends Group[MdnsRecord] {
private[this] val services = new mutable.HashMap[String, MdnsRecord]()
protected[finagle] val set = Var(Set[MdnsRecord]())
DNS.addServiceListener(regType, new ServiceListener {
def serviceResolved(event: ServiceEvent) {}
def serviceAdded(event: ServiceEvent) {
DNS.getServiceInfo(event.getType, event.getName) foreach { info =>
val addresses = info.getInetAddresses
val mdnsRecord = MdnsRecord(
info.getName,
info.getApplication + "." + info.getProtocol,
info.getDomain,
new InetSocketAddress(addresses(0), info.getPort))
synchronized {
services.put(info.getName, mdnsRecord)
set() = services.values.toSet
}
}
}
def serviceRemoved(event: ServiceEvent) {
synchronized {
if (services.remove(event.getName).isDefined)
set() = services.values.toSet
}
}
})
}
| {
"content_hash": "ef7399b10cec57380ed4c15e9d849390",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 81,
"avg_line_length": 30.128205128205128,
"alnum_prop": 0.6567375886524822,
"repo_name": "JustinTulloss/finagle",
"id": "54fa0875276735ad321a3ee25a2c9208f270ea58",
"size": "3525",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "finagle-mdns/src/main/scala/com/twitter/finagle/mdns/JmDNS.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
/* CensoBundle:ActividadComercialVivienda:edit.html.twig */
class __TwigTemplate_187cc1b3e8a743fb0853022bc8c0d2867de5b2af84994a5280eb6c0e659a5354 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = $this->env->loadTemplate("::base.html.twig");
$this->blocks = array(
'body' => array($this, 'block_body'),
);
}
protected function doGetParent(array $context)
{
return "::base.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_body($context, array $blocks = array())
{
// line 4
echo "<h1>ActividadComercialVivienda edit</h1>
";
// line 6
echo $this->env->getExtension('form')->renderer->renderBlock((isset($context["edit_form"]) ? $context["edit_form"] : $this->getContext($context, "edit_form")), 'form');
echo "
<ul class=\"record_actions\">
<li>
<a href=\"";
// line 10
echo $this->env->getExtension('routing')->getPath("actividadcomercialvivienda");
echo "\">
Back to the list
</a>
</li>
<li>";
// line 14
echo $this->env->getExtension('form')->renderer->renderBlock((isset($context["delete_form"]) ? $context["delete_form"] : $this->getContext($context, "delete_form")), 'form');
echo "</li>
</ul>
";
}
public function getTemplateName()
{
return "CensoBundle:ActividadComercialVivienda:edit.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 49 => 14, 42 => 10, 35 => 6, 31 => 4, 28 => 3,);
}
}
| {
"content_hash": "03ef2c0e64e9b90ceea68073d80e0c68",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 190,
"avg_line_length": 27.768115942028984,
"alnum_prop": 0.5709812108559499,
"repo_name": "profa1131/censo",
"id": "c34fee4a4d8dcc732f52bba9381acae6b9399aa8",
"size": "1916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/cache/dev/twig/18/7c/c1b3e8a743fb0853022bc8c0d2867de5b2af84994a5280eb6c0e659a5354.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "360000"
},
{
"name": "JavaScript",
"bytes": "2057042"
},
{
"name": "PHP",
"bytes": "517195"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1921d6ba73bcfb3678d82f7006998e88",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "837f5f68af3ea255de133731056fc5c0bfa6cbf9",
"size": "216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Protozoa/Ciliophora/Heterotrichea/Heterotrichida/Metopidae/Metopus/Metopus inversus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
background-image: url("../image/header.jpg");
background-repeat: no-repeat;
background-size: cover;
color:white;
}
| {
"content_hash": "e98781c0aa499c0cdb23cc30a55a6c7a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 49,
"avg_line_length": 18.428571428571427,
"alnum_prop": 0.6589147286821705,
"repo_name": "BD35550/OC_P3_Louvre",
"id": "9b815753ae4d4852bfb77031141c3fe459cf10d2",
"size": "140",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/bundles/louvreticket/css/style.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3605"
},
{
"name": "CSS",
"bytes": "7762"
},
{
"name": "HTML",
"bytes": "26473"
},
{
"name": "JavaScript",
"bytes": "2845"
},
{
"name": "PHP",
"bytes": "82326"
}
],
"symlink_target": ""
} |
namespace gfx
{
#ifdef GFX_ENABLE_CUDA
using namespace Slang;
namespace cuda
{
int DeviceImpl::_calcSMCountPerMultiProcessor(int major, int minor)
{
// Defines for GPU Architecture types (using the SM version to determine
// the # of cores per SM
struct SMInfo
{
int sm; // 0xMm (hexadecimal notation), M = SM Major version, and m = SM minor version
int coreCount;
};
static const SMInfo infos[] = {
{0x30, 192},
{0x32, 192},
{0x35, 192},
{0x37, 192},
{0x50, 128},
{0x52, 128},
{0x53, 128},
{0x60, 64},
{0x61, 128},
{0x62, 128},
{0x70, 64},
{0x72, 64},
{0x75, 64} };
const int sm = ((major << 4) + minor);
for (Index i = 0; i < SLANG_COUNT_OF(infos); ++i)
{
if (infos[i].sm == sm)
{
return infos[i].coreCount;
}
}
const auto& last = infos[SLANG_COUNT_OF(infos) - 1];
// It must be newer presumably
SLANG_ASSERT(sm > last.sm);
// Default to the last entry
return last.coreCount;
}
SlangResult DeviceImpl::_findMaxFlopsDeviceIndex(int* outDeviceIndex)
{
int smPerMultiproc = 0;
int maxPerfDevice = -1;
int deviceCount = 0;
int devicesProhibited = 0;
uint64_t maxComputePerf = 0;
SLANG_CUDA_RETURN_ON_FAIL(cudaGetDeviceCount(&deviceCount));
// Find the best CUDA capable GPU device
for (int currentDevice = 0; currentDevice < deviceCount; ++currentDevice)
{
int computeMode = -1, major = 0, minor = 0;
SLANG_CUDA_RETURN_ON_FAIL(
cudaDeviceGetAttribute(&computeMode, cudaDevAttrComputeMode, currentDevice));
SLANG_CUDA_RETURN_ON_FAIL(
cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, currentDevice));
SLANG_CUDA_RETURN_ON_FAIL(
cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, currentDevice));
// If this GPU is not running on Compute Mode prohibited,
// then we can add it to the list
if (computeMode != cudaComputeModeProhibited)
{
if (major == 9999 && minor == 9999)
{
smPerMultiproc = 1;
}
else
{
smPerMultiproc = _calcSMCountPerMultiProcessor(major, minor);
}
int multiProcessorCount = 0, clockRate = 0;
SLANG_CUDA_RETURN_ON_FAIL(cudaDeviceGetAttribute(
&multiProcessorCount, cudaDevAttrMultiProcessorCount, currentDevice));
SLANG_CUDA_RETURN_ON_FAIL(
cudaDeviceGetAttribute(&clockRate, cudaDevAttrClockRate, currentDevice));
uint64_t compute_perf = uint64_t(multiProcessorCount) * smPerMultiproc * clockRate;
if (compute_perf > maxComputePerf)
{
maxComputePerf = compute_perf;
maxPerfDevice = currentDevice;
}
}
else
{
devicesProhibited++;
}
}
if (maxPerfDevice < 0)
{
return SLANG_FAIL;
}
*outDeviceIndex = maxPerfDevice;
return SLANG_OK;
}
SlangResult DeviceImpl::_initCuda(CUDAReportStyle reportType)
{
static CUresult res = cuInit(0);
SLANG_CUDA_RETURN_WITH_REPORT_ON_FAIL(res, reportType);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::getNativeDeviceHandles(InteropHandles* outHandles)
{
outHandles->handles[0].handleValue = (uint64_t)m_device;
outHandles->handles[0].api = InteropHandleAPI::CUDA;
return SLANG_OK;
}
SLANG_NO_THROW SlangResult SLANG_MCALL DeviceImpl::initialize(const Desc& desc)
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
SLANG_PTX,
"sm_5_1",
makeArray(slang::PreprocessorMacroDesc{ "__CUDA_COMPUTE__", "1" }).getView()));
SLANG_RETURN_ON_FAIL(RendererBase::initialize(desc));
SLANG_RETURN_ON_FAIL(_initCuda(reportType));
if (desc.adapterLUID)
{
int deviceCount = -1;
cuDeviceGetCount(&deviceCount);
for (int deviceIndex = 0; deviceIndex < deviceCount; ++deviceIndex)
{
if (cuda::getAdapterLUID(deviceIndex) == *desc.adapterLUID)
{
m_deviceIndex = deviceIndex;
break;
}
}
if (m_deviceIndex >= deviceCount)
return SLANG_E_INVALID_ARG;
}
else
{
SLANG_RETURN_ON_FAIL(_findMaxFlopsDeviceIndex(&m_deviceIndex));
}
SLANG_CUDA_RETURN_WITH_REPORT_ON_FAIL(cudaSetDevice(m_deviceIndex), reportType);
m_context = new CUDAContext();
SLANG_CUDA_RETURN_ON_FAIL(cuDeviceGet(&m_device, m_deviceIndex));
SLANG_CUDA_RETURN_WITH_REPORT_ON_FAIL(
cuCtxCreate(&m_context->m_context, 0, m_device), reportType);
// Not clear how to detect half support on CUDA. For now we'll assume we have it
{
m_features.add("half");
}
cudaDeviceProp deviceProps;
cudaGetDeviceProperties(&deviceProps, m_deviceIndex);
// Initialize DeviceInfo
{
m_info.deviceType = DeviceType::CUDA;
m_info.bindingStyle = BindingStyle::CUDA;
m_info.projectionStyle = ProjectionStyle::DirectX;
m_info.apiName = "CUDA";
static const float kIdentity[] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
::memcpy(m_info.identityProjectionMatrix, kIdentity, sizeof(kIdentity));
m_adapterName = deviceProps.name;
m_info.adapterName = m_adapterName.begin();
m_info.timestampFrequency = 1000000;
}
// Get device limits.
{
DeviceLimits limits = {};
limits.maxTextureDimension1D = deviceProps.maxSurface1D;
limits.maxTextureDimension2D = Math::Min(deviceProps.maxSurface2D[0], deviceProps.maxSurface2D[1]);
limits.maxTextureDimension3D = Math::Min(deviceProps.maxSurface3D[0], Math::Min(deviceProps.maxSurface3D[1], deviceProps.maxSurface3D[2]));
limits.maxTextureDimensionCube = deviceProps.maxSurfaceCubemap;
limits.maxTextureArrayLayers = Math::Min(deviceProps.maxSurface1DLayered[2], deviceProps.maxSurface2DLayered[2]);
// limits.maxVertexInputElements
// limits.maxVertexInputElementOffset
// limits.maxVertexStreams
// limits.maxVertexStreamStride
limits.maxComputeThreadsPerGroup = deviceProps.maxThreadsPerBlock;
limits.maxComputeThreadGroupSize[0] = deviceProps.maxThreadsDim[0];
limits.maxComputeThreadGroupSize[1] = deviceProps.maxThreadsDim[1];
limits.maxComputeThreadGroupSize[2] = deviceProps.maxThreadsDim[2];
limits.maxComputeDispatchThreadGroups[0] = deviceProps.maxGridSize[0];
limits.maxComputeDispatchThreadGroups[1] = deviceProps.maxGridSize[1];
limits.maxComputeDispatchThreadGroups[2] = deviceProps.maxGridSize[2];
// limits.maxViewports
// limits.maxViewportDimensions
// limits.maxFramebufferDimensions
// limits.maxShaderVisibleSamplers
m_info.limits = limits;
}
return SLANG_OK;
}
Result DeviceImpl::getCUDAFormat(Format format, CUarray_format* outFormat)
{
// TODO: Expand to cover all available formats that can be supported in CUDA
switch (format)
{
case Format::R32G32B32A32_FLOAT:
case Format::R32G32B32_FLOAT:
case Format::R32G32_FLOAT:
case Format::R32_FLOAT:
case Format::D32_FLOAT:
*outFormat = CU_AD_FORMAT_FLOAT;
return SLANG_OK;
case Format::R16G16B16A16_FLOAT:
case Format::R16G16_FLOAT:
case Format::R16_FLOAT:
*outFormat = CU_AD_FORMAT_HALF;
return SLANG_OK;
case Format::R32G32B32A32_UINT:
case Format::R32G32B32_UINT:
case Format::R32G32_UINT:
case Format::R32_UINT:
*outFormat = CU_AD_FORMAT_UNSIGNED_INT32;
return SLANG_OK;
case Format::R16G16B16A16_UINT:
case Format::R16G16_UINT:
case Format::R16_UINT:
*outFormat = CU_AD_FORMAT_UNSIGNED_INT16;
return SLANG_OK;
case Format::R8G8B8A8_UINT:
case Format::R8G8_UINT:
case Format::R8_UINT:
case Format::R8G8B8A8_UNORM:
*outFormat = CU_AD_FORMAT_UNSIGNED_INT8;
return SLANG_OK;
case Format::R32G32B32A32_SINT:
case Format::R32G32B32_SINT:
case Format::R32G32_SINT:
case Format::R32_SINT:
*outFormat = CU_AD_FORMAT_SIGNED_INT32;
return SLANG_OK;
case Format::R16G16B16A16_SINT:
case Format::R16G16_SINT:
case Format::R16_SINT:
*outFormat = CU_AD_FORMAT_SIGNED_INT16;
return SLANG_OK;
case Format::R8G8B8A8_SINT:
case Format::R8G8_SINT:
case Format::R8_SINT:
*outFormat = CU_AD_FORMAT_SIGNED_INT8;
return SLANG_OK;
default:
SLANG_ASSERT(!"Only support R32_FLOAT/R8G8B8A8_UNORM formats for now");
return SLANG_FAIL;
}
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createTextureResource(
const ITextureResource::Desc& desc,
const ITextureResource::SubresourceData* initData,
ITextureResource** outResource)
{
TextureResource::Desc srcDesc = fixupTextureDesc(desc);
RefPtr<TextureResourceImpl> tex = new TextureResourceImpl(srcDesc);
tex->m_cudaContext = m_context;
CUresourcetype resourceType;
// The size of the element/texel in bytes
size_t elementSize = 0;
// Our `ITextureResource::Desc` uses an enumeration to specify
// the "shape"/rank of a texture (1D, 2D, 3D, Cube), but CUDA's
// `cuMipmappedArrayCreate` seemingly relies on a policy where
// the extents of the array in dimenions above the rank are
// specified as zero (e.g., a 1D texture requires `height==0`).
//
// We will start by massaging the extents as specified by the
// user into a form that CUDA wants/expects, based on the
// texture shape as specified in the `desc`.
//
int width = desc.size.width;
int height = desc.size.height;
int depth = desc.size.depth;
switch (desc.type)
{
case IResource::Type::Texture1D:
height = 0;
depth = 0;
break;
case IResource::Type::Texture2D:
depth = 0;
break;
case IResource::Type::Texture3D:
break;
case IResource::Type::TextureCube:
depth = 1;
break;
}
{
CUarray_format format = CU_AD_FORMAT_FLOAT;
int numChannels = 0;
SLANG_RETURN_ON_FAIL(getCUDAFormat(desc.format, &format));
FormatInfo info;
gfxGetFormatInfo(desc.format, &info);
numChannels = info.channelCount;
switch (format)
{
case CU_AD_FORMAT_FLOAT:
{
elementSize = sizeof(float) * numChannels;
break;
}
case CU_AD_FORMAT_HALF:
{
elementSize = sizeof(uint16_t) * numChannels;
break;
}
case CU_AD_FORMAT_UNSIGNED_INT8:
{
elementSize = sizeof(uint8_t) * numChannels;
break;
}
default:
{
SLANG_ASSERT(!"Only support R32_FLOAT/R8G8B8A8_UNORM formats for now");
return SLANG_FAIL;
}
}
if (desc.numMipLevels > 1)
{
resourceType = CU_RESOURCE_TYPE_MIPMAPPED_ARRAY;
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
memset(&arrayDesc, 0, sizeof(arrayDesc));
arrayDesc.Width = width;
arrayDesc.Height = height;
arrayDesc.Depth = depth;
arrayDesc.Format = format;
arrayDesc.NumChannels = numChannels;
arrayDesc.Flags = 0;
if (desc.arraySize > 1)
{
if (desc.type == IResource::Type::Texture1D ||
desc.type == IResource::Type::Texture2D ||
desc.type == IResource::Type::TextureCube)
{
arrayDesc.Flags |= CUDA_ARRAY3D_LAYERED;
arrayDesc.Depth = desc.arraySize;
}
else
{
SLANG_ASSERT(!"Arrays only supported for 1D and 2D");
return SLANG_FAIL;
}
}
if (desc.type == IResource::Type::TextureCube)
{
arrayDesc.Flags |= CUDA_ARRAY3D_CUBEMAP;
arrayDesc.Depth *= 6;
}
SLANG_CUDA_RETURN_ON_FAIL(
cuMipmappedArrayCreate(&tex->m_cudaMipMappedArray, &arrayDesc, desc.numMipLevels));
}
else
{
resourceType = CU_RESOURCE_TYPE_ARRAY;
if (desc.arraySize > 1)
{
if (desc.type == IResource::Type::Texture1D ||
desc.type == IResource::Type::Texture2D ||
desc.type == IResource::Type::TextureCube)
{
SLANG_ASSERT(!"Only 1D, 2D and Cube arrays supported");
return SLANG_FAIL;
}
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
memset(&arrayDesc, 0, sizeof(arrayDesc));
// Set the depth as the array length
arrayDesc.Depth = desc.arraySize;
if (desc.type == IResource::Type::TextureCube)
{
arrayDesc.Depth *= 6;
}
arrayDesc.Height = height;
arrayDesc.Width = width;
arrayDesc.Format = format;
arrayDesc.NumChannels = numChannels;
if (desc.type == IResource::Type::TextureCube)
{
arrayDesc.Flags |= CUDA_ARRAY3D_CUBEMAP;
}
SLANG_CUDA_RETURN_ON_FAIL(cuArray3DCreate(&tex->m_cudaArray, &arrayDesc));
}
else if (desc.type == IResource::Type::Texture3D ||
desc.type == IResource::Type::TextureCube)
{
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
memset(&arrayDesc, 0, sizeof(arrayDesc));
arrayDesc.Depth = depth;
arrayDesc.Height = height;
arrayDesc.Width = width;
arrayDesc.Format = format;
arrayDesc.NumChannels = numChannels;
arrayDesc.Flags = 0;
// Handle cube texture
if (desc.type == IResource::Type::TextureCube)
{
arrayDesc.Depth = 6;
arrayDesc.Flags |= CUDA_ARRAY3D_CUBEMAP;
}
SLANG_CUDA_RETURN_ON_FAIL(cuArray3DCreate(&tex->m_cudaArray, &arrayDesc));
}
else
{
CUDA_ARRAY_DESCRIPTOR arrayDesc;
memset(&arrayDesc, 0, sizeof(arrayDesc));
arrayDesc.Height = height;
arrayDesc.Width = width;
arrayDesc.Format = format;
arrayDesc.NumChannels = numChannels;
// Allocate the array, will work for 1D or 2D case
SLANG_CUDA_RETURN_ON_FAIL(cuArrayCreate(&tex->m_cudaArray, &arrayDesc));
}
}
}
// Work space for holding data for uploading if it needs to be rearranged
if (initData)
{
List<uint8_t> workspace;
for (int mipLevel = 0; mipLevel < desc.numMipLevels; ++mipLevel)
{
int mipWidth = width >> mipLevel;
int mipHeight = height >> mipLevel;
int mipDepth = depth >> mipLevel;
mipWidth = (mipWidth == 0) ? 1 : mipWidth;
mipHeight = (mipHeight == 0) ? 1 : mipHeight;
mipDepth = (mipDepth == 0) ? 1 : mipDepth;
// If it's a cubemap then the depth is always 6
if (desc.type == IResource::Type::TextureCube)
{
mipDepth = 6;
}
auto dstArray = tex->m_cudaArray;
if (tex->m_cudaMipMappedArray)
{
// Get the array for the mip level
SLANG_CUDA_RETURN_ON_FAIL(
cuMipmappedArrayGetLevel(&dstArray, tex->m_cudaMipMappedArray, mipLevel));
}
SLANG_ASSERT(dstArray);
// Check using the desc to see if it's plausible
{
CUDA_ARRAY_DESCRIPTOR arrayDesc;
SLANG_CUDA_RETURN_ON_FAIL(cuArrayGetDescriptor(&arrayDesc, dstArray));
SLANG_ASSERT(mipWidth == arrayDesc.Width);
SLANG_ASSERT(
mipHeight == arrayDesc.Height || (mipHeight == 1 && arrayDesc.Height == 0));
}
const void* srcDataPtr = nullptr;
if (desc.arraySize > 1)
{
SLANG_ASSERT(
desc.type == IResource::Type::Texture1D ||
desc.type == IResource::Type::Texture2D ||
desc.type == IResource::Type::TextureCube);
// TODO(JS): Here I assume that arrays are just held contiguously within a
// 'face' This seems reasonable and works with the Copy3D.
const size_t faceSizeInBytes = elementSize * mipWidth * mipHeight;
Index faceCount = desc.arraySize;
if (desc.type == IResource::Type::TextureCube)
{
faceCount *= 6;
}
const size_t mipSizeInBytes = faceSizeInBytes * faceCount;
workspace.setCount(mipSizeInBytes);
// We need to add the face data from each mip
// We iterate over face count so we copy all of the cubemap faces
for (Index j = 0; j < faceCount; j++)
{
const auto srcData = initData[mipLevel + j * desc.numMipLevels].data;
// Copy over to the workspace to make contiguous
::memcpy(
workspace.begin() + faceSizeInBytes * j, srcData, faceSizeInBytes);
}
srcDataPtr = workspace.getBuffer();
}
else
{
if (desc.type == IResource::Type::TextureCube)
{
size_t faceSizeInBytes = elementSize * mipWidth * mipHeight;
workspace.setCount(faceSizeInBytes * 6);
// Copy the data over to make contiguous
for (Index j = 0; j < 6; j++)
{
const auto srcData =
initData[mipLevel + j * desc.numMipLevels].data;
::memcpy(
workspace.getBuffer() + faceSizeInBytes * j,
srcData,
faceSizeInBytes);
}
srcDataPtr = workspace.getBuffer();
}
else
{
const auto srcData = initData[mipLevel].data;
srcDataPtr = srcData;
}
}
if (desc.arraySize > 1)
{
SLANG_ASSERT(
desc.type == IResource::Type::Texture1D ||
desc.type == IResource::Type::Texture2D ||
desc.type == IResource::Type::TextureCube);
CUDA_MEMCPY3D copyParam;
memset(©Param, 0, sizeof(copyParam));
copyParam.dstMemoryType = CU_MEMORYTYPE_ARRAY;
copyParam.dstArray = dstArray;
copyParam.srcMemoryType = CU_MEMORYTYPE_HOST;
copyParam.srcHost = srcDataPtr;
copyParam.srcPitch = mipWidth * elementSize;
copyParam.WidthInBytes = copyParam.srcPitch;
copyParam.Height = mipHeight;
// Set the depth to the array length
copyParam.Depth = desc.arraySize;
if (desc.type == IResource::Type::TextureCube)
{
copyParam.Depth *= 6;
}
SLANG_CUDA_RETURN_ON_FAIL(cuMemcpy3D(©Param));
}
else
{
switch (desc.type)
{
case IResource::Type::Texture1D:
case IResource::Type::Texture2D:
{
CUDA_MEMCPY2D copyParam;
memset(©Param, 0, sizeof(copyParam));
copyParam.dstMemoryType = CU_MEMORYTYPE_ARRAY;
copyParam.dstArray = dstArray;
copyParam.srcMemoryType = CU_MEMORYTYPE_HOST;
copyParam.srcHost = srcDataPtr;
copyParam.srcPitch = mipWidth * elementSize;
copyParam.WidthInBytes = copyParam.srcPitch;
copyParam.Height = mipHeight;
SLANG_CUDA_RETURN_ON_FAIL(cuMemcpy2D(©Param));
break;
}
case IResource::Type::Texture3D:
case IResource::Type::TextureCube:
{
CUDA_MEMCPY3D copyParam;
memset(©Param, 0, sizeof(copyParam));
copyParam.dstMemoryType = CU_MEMORYTYPE_ARRAY;
copyParam.dstArray = dstArray;
copyParam.srcMemoryType = CU_MEMORYTYPE_HOST;
copyParam.srcHost = srcDataPtr;
copyParam.srcPitch = mipWidth * elementSize;
copyParam.WidthInBytes = copyParam.srcPitch;
copyParam.Height = mipHeight;
copyParam.Depth = mipDepth;
SLANG_CUDA_RETURN_ON_FAIL(cuMemcpy3D(©Param));
break;
}
default:
{
SLANG_ASSERT(!"Not implemented");
break;
}
}
}
}
}
// Set up texture sampling parameters, and create final texture obj
{
CUDA_RESOURCE_DESC resDesc;
memset(&resDesc, 0, sizeof(CUDA_RESOURCE_DESC));
resDesc.resType = resourceType;
if (tex->m_cudaArray)
{
resDesc.res.array.hArray = tex->m_cudaArray;
}
if (tex->m_cudaMipMappedArray)
{
resDesc.res.mipmap.hMipmappedArray = tex->m_cudaMipMappedArray;
}
// If the texture might be used as a UAV, then we need to allocate
// a CUDA "surface" for it.
//
// Note: We cannot do this unconditionally, because it will fail
// on surfaces that are not usable as UAVs (e.g., those with
// mipmaps).
//
// TODO: We should really only be allocating the array at the
// time we create a resource, and then allocate the surface or
// texture objects as part of view creation.
//
if (desc.allowedStates.contains(ResourceState::UnorderedAccess))
{
// On CUDA surfaces only support a single MIP map
SLANG_ASSERT(desc.numMipLevels == 1);
SLANG_CUDA_RETURN_ON_FAIL(cuSurfObjectCreate(&tex->m_cudaSurfObj, &resDesc));
}
// Create handle for sampling.
CUDA_TEXTURE_DESC texDesc;
memset(&texDesc, 0, sizeof(CUDA_TEXTURE_DESC));
texDesc.addressMode[0] = CU_TR_ADDRESS_MODE_WRAP;
texDesc.addressMode[1] = CU_TR_ADDRESS_MODE_WRAP;
texDesc.addressMode[2] = CU_TR_ADDRESS_MODE_WRAP;
texDesc.filterMode = CU_TR_FILTER_MODE_LINEAR;
texDesc.flags = CU_TRSF_NORMALIZED_COORDINATES;
SLANG_CUDA_RETURN_ON_FAIL(
cuTexObjectCreate(&tex->m_cudaTexObj, &resDesc, &texDesc, nullptr));
}
returnComPtr(outResource, tex);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createBufferResource(
const IBufferResource::Desc& descIn,
const void* initData,
IBufferResource** outResource)
{
auto desc = fixupBufferDesc(descIn);
RefPtr<BufferResourceImpl> resource = new BufferResourceImpl(desc);
resource->m_cudaContext = m_context;
SLANG_CUDA_RETURN_ON_FAIL(cudaMallocManaged(&resource->m_cudaMemory, desc.sizeInBytes));
if (initData)
{
SLANG_CUDA_RETURN_ON_FAIL(cudaMemcpy(resource->m_cudaMemory, initData, desc.sizeInBytes, cudaMemcpyDefault));
}
returnComPtr(outResource, resource);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createBufferFromSharedHandle(
InteropHandle handle,
const IBufferResource::Desc& desc,
IBufferResource** outResource)
{
if (handle.handleValue == 0)
{
*outResource = nullptr;
return SLANG_OK;
}
RefPtr<BufferResourceImpl> resource = new BufferResourceImpl(desc);
resource->m_cudaContext = m_context;
// CUDA manages sharing of buffers through the idea of an
// "external memory" object, which represents the relationship
// with another API's objects. In order to create this external
// memory association, we first need to fill in a descriptor struct.
cudaExternalMemoryHandleDesc externalMemoryHandleDesc;
memset(&externalMemoryHandleDesc, 0, sizeof(externalMemoryHandleDesc));
switch (handle.api)
{
case InteropHandleAPI::D3D12:
externalMemoryHandleDesc.type = cudaExternalMemoryHandleTypeD3D12Resource;
break;
case InteropHandleAPI::Vulkan:
externalMemoryHandleDesc.type = cudaExternalMemoryHandleTypeOpaqueWin32;
break;
default:
return SLANG_FAIL;
}
externalMemoryHandleDesc.handle.win32.handle = (void*)handle.handleValue;
externalMemoryHandleDesc.size = desc.sizeInBytes;
externalMemoryHandleDesc.flags = cudaExternalMemoryDedicated;
// Once we have filled in the descriptor, we can request
// that CUDA create the required association between the
// external buffer and its own memory.
cudaExternalMemory_t externalMemory;
SLANG_CUDA_RETURN_ON_FAIL(cudaImportExternalMemory(&externalMemory, &externalMemoryHandleDesc));
resource->m_cudaExternalMemory = externalMemory;
// The CUDA "external memory" handle is not itself a device
// pointer, so we need to query for a suitable device address
// for the buffer with another call.
//
// Just as for the external memory, we fill in a descriptor
// structure (although in this case we only need to specify
// the size).
cudaExternalMemoryBufferDesc bufferDesc;
memset(&bufferDesc, 0, sizeof(bufferDesc));
bufferDesc.size = desc.sizeInBytes;
// Finally, we can "map" the buffer to get a device address.
void* deviceAddress;
SLANG_CUDA_RETURN_ON_FAIL(cudaExternalMemoryGetMappedBuffer(&deviceAddress, externalMemory, &bufferDesc));
resource->m_cudaMemory = deviceAddress;
returnComPtr(outResource, resource);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createTextureFromSharedHandle(
InteropHandle handle,
const ITextureResource::Desc& desc,
const size_t size,
ITextureResource** outResource)
{
if (handle.handleValue == 0)
{
*outResource = nullptr;
return SLANG_OK;
}
RefPtr<TextureResourceImpl> resource = new TextureResourceImpl(desc);
resource->m_cudaContext = m_context;
// CUDA manages sharing of buffers through the idea of an
// "external memory" object, which represents the relationship
// with another API's objects. In order to create this external
// memory association, we first need to fill in a descriptor struct.
CUDA_EXTERNAL_MEMORY_HANDLE_DESC externalMemoryHandleDesc;
memset(&externalMemoryHandleDesc, 0, sizeof(externalMemoryHandleDesc));
switch (handle.api)
{
case InteropHandleAPI::D3D12:
externalMemoryHandleDesc.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE;
break;
case InteropHandleAPI::Vulkan:
externalMemoryHandleDesc.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32;
break;
default:
return SLANG_FAIL;
}
externalMemoryHandleDesc.handle.win32.handle = (void*)handle.handleValue;
externalMemoryHandleDesc.size = size;
externalMemoryHandleDesc.flags = cudaExternalMemoryDedicated;
CUexternalMemory externalMemory;
SLANG_CUDA_RETURN_ON_FAIL(cuImportExternalMemory(&externalMemory, &externalMemoryHandleDesc));
resource->m_cudaExternalMemory = externalMemory;
FormatInfo formatInfo;
SLANG_RETURN_ON_FAIL(gfxGetFormatInfo(desc.format, &formatInfo));
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
arrayDesc.Depth = desc.size.depth;
arrayDesc.Height = desc.size.height;
arrayDesc.Width = desc.size.width;
arrayDesc.NumChannels = formatInfo.channelCount;
getCUDAFormat(desc.format, &arrayDesc.Format);
arrayDesc.Flags = 0; // TODO: Flags? CUDA_ARRAY_LAYERED/SURFACE_LDST/CUBEMAP/TEXTURE_GATHER
CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC externalMemoryMipDesc;
memset(&externalMemoryMipDesc, 0, sizeof(externalMemoryMipDesc));
externalMemoryMipDesc.offset = 0;
externalMemoryMipDesc.arrayDesc = arrayDesc;
externalMemoryMipDesc.numLevels = desc.numMipLevels;
CUmipmappedArray mipArray;
SLANG_CUDA_RETURN_ON_FAIL(cuExternalMemoryGetMappedMipmappedArray(&mipArray, externalMemory, &externalMemoryMipDesc));
resource->m_cudaMipMappedArray = mipArray;
CUarray cuArray;
SLANG_CUDA_RETURN_ON_FAIL(cuMipmappedArrayGetLevel(&cuArray, mipArray, 0));
resource->m_cudaArray = cuArray;
CUDA_RESOURCE_DESC surfDesc;
memset(&surfDesc, 0, sizeof(surfDesc));
surfDesc.resType = CU_RESOURCE_TYPE_ARRAY;
surfDesc.res.array.hArray = cuArray;
CUsurfObject surface;
SLANG_CUDA_RETURN_ON_FAIL(cuSurfObjectCreate(&surface, &surfDesc));
resource->m_cudaSurfObj = surface;
returnComPtr(outResource, resource);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createTextureView(
ITextureResource* texture, IResourceView::Desc const& desc, IResourceView** outView)
{
RefPtr<ResourceViewImpl> view = new ResourceViewImpl();
view->m_desc = desc;
view->textureResource = dynamic_cast<TextureResourceImpl*>(texture);
returnComPtr(outView, view);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createBufferView(
IBufferResource* buffer,
IBufferResource* counterBuffer,
IResourceView::Desc const& desc,
IResourceView** outView)
{
RefPtr<ResourceViewImpl> view = new ResourceViewImpl();
view->m_desc = desc;
view->memoryResource = dynamic_cast<BufferResourceImpl*>(buffer);
returnComPtr(outView, view);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createQueryPool(
const IQueryPool::Desc& desc,
IQueryPool** outPool)
{
RefPtr<QueryPoolImpl> pool = new QueryPoolImpl();
SLANG_RETURN_ON_FAIL(pool->init(desc));
returnComPtr(outPool, pool);
return SLANG_OK;
}
Result DeviceImpl::createShaderObjectLayout(
slang::TypeLayoutReflection* typeLayout,
ShaderObjectLayoutBase** outLayout)
{
RefPtr<ShaderObjectLayoutImpl> cudaLayout;
cudaLayout = new ShaderObjectLayoutImpl(this, typeLayout);
returnRefPtrMove(outLayout, cudaLayout);
return SLANG_OK;
}
Result DeviceImpl::createShaderObject(
ShaderObjectLayoutBase* layout,
IShaderObject** outObject)
{
RefPtr<ShaderObjectImpl> result = new ShaderObjectImpl();
SLANG_RETURN_ON_FAIL(result->init(this, dynamic_cast<ShaderObjectLayoutImpl*>(layout)));
returnComPtr(outObject, result);
return SLANG_OK;
}
Result DeviceImpl::createMutableShaderObject(
ShaderObjectLayoutBase* layout,
IShaderObject** outObject)
{
RefPtr<MutableShaderObjectImpl> result = new MutableShaderObjectImpl();
SLANG_RETURN_ON_FAIL(result->init(this, dynamic_cast<ShaderObjectLayoutImpl*>(layout)));
returnComPtr(outObject, result);
return SLANG_OK;
}
Result DeviceImpl::createRootShaderObject(IShaderProgram* program, ShaderObjectBase** outObject)
{
auto cudaProgram = dynamic_cast<ShaderProgramImpl*>(program);
auto cudaLayout = cudaProgram->layout;
RefPtr<RootShaderObjectImpl> result = new RootShaderObjectImpl();
SLANG_RETURN_ON_FAIL(result->init(this, cudaLayout));
returnRefPtrMove(outObject, result);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createProgram(
const IShaderProgram::Desc& desc,
IShaderProgram** outProgram,
ISlangBlob** outDiagnosticBlob)
{
// If this is a specializable program, we just keep a reference to the slang program and
// don't actually create any kernels. This program will be specialized later when we know
// the shader object bindings.
RefPtr<ShaderProgramImpl> cudaProgram = new ShaderProgramImpl();
cudaProgram->init(desc);
cudaProgram->cudaContext = m_context;
if (desc.slangGlobalScope->getSpecializationParamCount() != 0)
{
cudaProgram->layout = new RootShaderObjectLayoutImpl(this, desc.slangGlobalScope->getLayout());
returnComPtr(outProgram, cudaProgram);
return SLANG_OK;
}
ComPtr<ISlangBlob> kernelCode;
ComPtr<ISlangBlob> diagnostics;
auto compileResult = getEntryPointCodeFromShaderCache(desc.slangGlobalScope,
(SlangInt)0, 0, kernelCode.writeRef(), diagnostics.writeRef());
if (diagnostics)
{
getDebugCallback()->handleMessage(
compileResult == SLANG_OK ? DebugMessageType::Warning : DebugMessageType::Error,
DebugMessageSource::Slang,
(char*)diagnostics->getBufferPointer());
if (outDiagnosticBlob)
returnComPtr(outDiagnosticBlob, diagnostics);
}
SLANG_RETURN_ON_FAIL(compileResult);
SLANG_CUDA_RETURN_ON_FAIL(cuModuleLoadData(&cudaProgram->cudaModule, kernelCode->getBufferPointer()));
cudaProgram->kernelName = desc.slangGlobalScope->getLayout()->getEntryPointByIndex(0)->getName();
SLANG_CUDA_RETURN_ON_FAIL(cuModuleGetFunction(
&cudaProgram->cudaKernel, cudaProgram->cudaModule, cudaProgram->kernelName.getBuffer()));
auto slangGlobalScope = desc.slangGlobalScope;
if (slangGlobalScope)
{
cudaProgram->slangGlobalScope = slangGlobalScope;
auto slangProgramLayout = slangGlobalScope->getLayout();
if (!slangProgramLayout)
return SLANG_FAIL;
RefPtr<RootShaderObjectLayoutImpl> cudaLayout;
cudaLayout = new RootShaderObjectLayoutImpl(this, slangProgramLayout);
cudaLayout->programLayout = slangProgramLayout;
cudaProgram->layout = cudaLayout;
}
returnComPtr(outProgram, cudaProgram);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createComputePipelineState(
const ComputePipelineStateDesc& desc, IPipelineState** outState)
{
RefPtr<ComputePipelineStateImpl> state = new ComputePipelineStateImpl();
state->shaderProgram = static_cast<ShaderProgramImpl*>(desc.program);
state->init(desc);
returnComPtr(outState, state);
return Result();
}
void* DeviceImpl::map(IBufferResource* buffer)
{
return static_cast<BufferResourceImpl*>(buffer)->m_cudaMemory;
}
void DeviceImpl::unmap(IBufferResource* buffer)
{
SLANG_UNUSED(buffer);
}
SLANG_NO_THROW const DeviceInfo& SLANG_MCALL DeviceImpl::getDeviceInfo() const
{
return m_info;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createTransientResourceHeap(
const ITransientResourceHeap::Desc& desc,
ITransientResourceHeap** outHeap)
{
RefPtr<TransientResourceHeapImpl> result = new TransientResourceHeapImpl();
SLANG_RETURN_ON_FAIL(result->init(this, desc));
returnComPtr(outHeap, result);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL
DeviceImpl::createCommandQueue(const ICommandQueue::Desc& desc, ICommandQueue** outQueue)
{
RefPtr<CommandQueueImpl> queue = new CommandQueueImpl();
queue->init(this);
returnComPtr(outQueue, queue);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createSwapchain(
const ISwapchain::Desc& desc, WindowHandle window, ISwapchain** outSwapchain)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(window);
SLANG_UNUSED(outSwapchain);
return SLANG_FAIL;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createFramebufferLayout(
const IFramebufferLayout::Desc& desc, IFramebufferLayout** outLayout)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(outLayout);
return SLANG_FAIL;
}
SLANG_NO_THROW Result SLANG_MCALL
DeviceImpl::createFramebuffer(const IFramebuffer::Desc& desc, IFramebuffer** outFramebuffer)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(outFramebuffer);
return SLANG_FAIL;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createRenderPassLayout(
const IRenderPassLayout::Desc& desc,
IRenderPassLayout** outRenderPassLayout)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(outRenderPassLayout);
return SLANG_FAIL;
}
SLANG_NO_THROW Result SLANG_MCALL
DeviceImpl::createSamplerState(ISamplerState::Desc const& desc, ISamplerState** outSampler)
{
SLANG_UNUSED(desc);
*outSampler = nullptr;
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createInputLayout(
IInputLayout::Desc const& desc,
IInputLayout** outLayout)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(outLayout);
return SLANG_E_NOT_AVAILABLE;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::createGraphicsPipelineState(
const GraphicsPipelineStateDesc& desc, IPipelineState** outState)
{
SLANG_UNUSED(desc);
SLANG_UNUSED(outState);
return SLANG_E_NOT_AVAILABLE;
}
SLANG_NO_THROW SlangResult SLANG_MCALL DeviceImpl::readTextureResource(
ITextureResource* texture,
ResourceState state,
ISlangBlob** outBlob,
size_t* outRowPitch,
size_t* outPixelSize)
{
auto textureImpl = static_cast<TextureResourceImpl*>(texture);
List<uint8_t> blobData;
auto desc = textureImpl->getDesc();
auto width = desc->size.width;
auto height = desc->size.height;
FormatInfo sizeInfo;
SLANG_RETURN_ON_FAIL(gfxGetFormatInfo(desc->format, &sizeInfo));
size_t pixelSize = sizeInfo.blockSizeInBytes / sizeInfo.pixelsPerBlock;
size_t rowPitch = width * pixelSize;
size_t size = height * rowPitch;
blobData.setCount((Index)size);
CUDA_MEMCPY2D copyParam;
memset(©Param, 0, sizeof(copyParam));
copyParam.srcMemoryType = CU_MEMORYTYPE_ARRAY;
copyParam.srcArray = textureImpl->m_cudaArray;
copyParam.dstMemoryType = CU_MEMORYTYPE_HOST;
copyParam.dstHost = blobData.getBuffer();
copyParam.dstPitch = rowPitch;
copyParam.WidthInBytes = copyParam.dstPitch;
copyParam.Height = height;
SLANG_CUDA_RETURN_ON_FAIL(cuMemcpy2D(©Param));
*outRowPitch = rowPitch;
*outPixelSize = pixelSize;
auto blob = ListBlob::moveCreate(blobData);
returnComPtr(outBlob, blob);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL DeviceImpl::readBufferResource(
IBufferResource* buffer,
size_t offset,
size_t size,
ISlangBlob** outBlob)
{
auto bufferImpl = static_cast<BufferResourceImpl*>(buffer);
List<uint8_t> blobData;
blobData.setCount((Index)size);
cudaMemcpy(
blobData.getBuffer(),
(uint8_t*)bufferImpl->m_cudaMemory + offset,
size,
cudaMemcpyDefault);
auto blob = ListBlob::moveCreate(blobData);
returnComPtr(outBlob, blob);
return SLANG_OK;
}
} // namespace cuda
#endif
} // namespace gfx
| {
"content_hash": "e855a2239ecf4e47d53ca7adb6d71dbe",
"timestamp": "",
"source": "github",
"line_count": 1160,
"max_line_length": 147,
"avg_line_length": 34.09396551724138,
"alnum_prop": 0.6240865761460467,
"repo_name": "shader-slang/slang",
"id": "f81bcfe997587a4db096b739b1a4e3377acd4550",
"size": "39872",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/gfx/cuda/cuda-device.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2330"
},
{
"name": "C",
"bytes": "162223"
},
{
"name": "C++",
"bytes": "11421818"
},
{
"name": "Cuda",
"bytes": "176"
},
{
"name": "GLSL",
"bytes": "67132"
},
{
"name": "HLSL",
"bytes": "71369"
},
{
"name": "Lua",
"bytes": "57242"
},
{
"name": "Shell",
"bytes": "3616"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_vertical_margin"
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/apiTokenEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:gravity="center"
android:hint="@string/label_enter_api_key" />
<Button
android:id="@+id/loginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/label_login" />
</LinearLayout>
</LinearLayout> | {
"content_hash": "8546899d6fade95319da56bf39e0f3ec",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 34,
"alnum_prop": 0.6299810246679317,
"repo_name": "vishnus1224/RxJavaTeamworkClient",
"id": "79cc78816505577cec25fcad4f7e52755eec0a29",
"size": "1054",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TeamworkApiDemo/app/src/main/res/layout/activity_login.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "216611"
}
],
"symlink_target": ""
} |
class Dogs::ManagerController < Dogs::DogsBaseController
helper_method :fostering_dog?
autocomplete :breed, :name, full: true
before_action :send_unauthenticated_to_public_profile, only: %i[show]
before_action :require_login
before_action :unlocked_user
before_action :active_user
before_action :admin_user, only: %i[destroy]
before_action :add_dogs_user, only: %i[new create]
before_action :load_dog, only: %i[show edit update destroy]
before_action :edit_dog_check, only: %i[edit update]
before_action :select_bootstrap41
before_action :show_user_navbar
def index
session[:last_dog_manager_search] = request.url
params[:filter_params] ||= {}
@dog_filter = DogFilter.new search_params.merge({inhibit_pagination: request.format.xls?})
@dogs, @count, @filter_params = @dog_filter.filter
respond_to do |format|
format.html
format.xls { render_dogs_xls }
end
end
def new
@dog = Dog.new
@on_cancel_path = dogs_manager_index_path
load_instance_variables
end
def edit
load_instance_variables
@on_cancel_path = dogs_manager_path(@dog)
end
def update
if @dog.update(dog_params)
flash[:success] = 'Dog updated.'
redirect_to dogs_manager_path(@dog)
else
load_instance_variables
flash.now[:error] = 'form could not be saved, see errors below'
render 'edit'
end
end
def create
@dog = Dog.new(dog_params)
@dog.tracking_id = Dog.next_tracking_id if @dog.tracking_id.blank?
if @dog.save
flash[:success] = "New Dog Added"
redirect_to dogs_manager_index_path
else
load_instance_variables
flash.now[:error] = 'form could not be saved, see errors below'
render 'new'
end
end
def destroy
@dog.destroy
flash[:success] = "Dog deleted."
redirect_to dogs_path
end
private
def search_params
# filter_params is not required as it is not supplied for the default manager view
params.permit(:page,
filter_params: [:sort,
:direction,
:search,
:search_field_index,
is_age: [],
is_status:[],
is_size:[],
has_flags:[]])
end
def dog_params
params.require(:dog)
.permit(:name, :tracking_id, :primary_breed_id, :primary_breed_name, :secondary_breed_id,
:secondary_breed_name, :status, :age, :size, :energy_level, :is_altered, :gender, :is_special_needs,
:no_dogs, :no_cats, :no_kids, :description, :photos_attributes, :foster_id, :foster_start_date,
:adoption_date, :is_uptodateonshots, :intake_dt, :available_on_dt, :has_medical_need,
:is_high_priority, :needs_photos, :has_behavior_problem, :needs_foster, :attachments_attributes,
:petfinder_ad_url, :adoptapet_ad_url, :craigslist_ad_url, :youtube_video_url, :first_shots,
:second_shots, :third_shots, :rabies, :vac_4dx, :heartworm_preventative, :flea_tick_preventative,
:bordetella, :microchip, :original_name, :fee, :coordinator_id, :sponsored_by, :shelter_id,
:medical_summary, :wait_list, :behavior_summary, :medical_review_complete, :dewormer, :toltrazuril, :hidden,
:no_urban_setting, :home_check_required,
attachments_attributes: [ :attachment, :description, :updated_by_user_id, :_destroy, :id ],
photos_attributes: [ :photo, :position, :is_private, :_destroy, :id ])
end
def load_instance_variables
@foster_users = User.where(is_foster: true).order("name")
@coordinator_users = User.where(edit_all_adopters: true).order("name")
@shelters = Shelter.order("name")
@breeds = Breed.all
end
def edit_dogs_user
redirect_to(root_path) unless current_user.edit_dogs?
end
def add_dogs_user
redirect_to(root_path) unless current_user.add_dogs?
end
def admin_user
redirect_to(root_path) unless current_user.admin?
end
def fostering_dog?
return false unless signed_in?
@dog.foster_id == current_user.id
end
def edit_dog_check
redirect_to(root_path) unless fostering_dog? || current_user.edit_dogs?
end
def active_user
redirect_to dogs_path unless current_user&.active?
end
def send_unauthenticated_to_public_profile
redirect_to(dog_path(params[:id])) unless signed_in?
end
def render_dogs_xls
send_data @dogs.to_xls(columns: [:id,
:tracking_id,
:name,
{ primary_breed: [:name] },
{ secondary_breed: [:name] },
:age,
:size,
:intake_dt,
{ foster: %i[name city region] }],
headers: ['DMS ID',
'Tracking ID',
'Name',
'Primary Breed',
'Secondary Breed',
'Age',
'Size',
'Intake Date',
'Foster Name',
'Foster City',
'Foster State']),
filename: 'dog_export.xls'
end
end
| {
"content_hash": "be5ccacdcc2b00bba6a6420d2f422bef",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 122,
"avg_line_length": 35.024844720496894,
"alnum_prop": 0.5497428622096117,
"repo_name": "ophrescue/RescueRails",
"id": "379e4357dec1b32c40924ad2dd4ba38ffd2aa227",
"size": "7989",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/controllers/dogs/manager_controller.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "774988"
},
{
"name": "JavaScript",
"bytes": "232192"
},
{
"name": "Ruby",
"bytes": "853583"
},
{
"name": "SCSS",
"bytes": "20081"
},
{
"name": "Shell",
"bytes": "168"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_25) on Sun Jun 17 15:48:10 CEST 2012 -->
<TITLE>
Uses of Class utbm.tx52.suiviGPS.ParamActivity
</TITLE>
<META NAME="date" CONTENT="2012-06-17">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class utbm.tx52.suiviGPS.ParamActivity";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../utbm/tx52/suiviGPS/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../utbm/tx52/suiviGPS/ParamActivity.html" title="class in utbm.tx52.suiviGPS"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?utbm/tx52/suiviGPS/\class-useParamActivity.html" target="_top"><B>FRAMES</B></A>
<A HREF="ParamActivity.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>utbm.tx52.suiviGPS.ParamActivity</B></H2>
</CENTER>
No usage of utbm.tx52.suiviGPS.ParamActivity
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../utbm/tx52/suiviGPS/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../utbm/tx52/suiviGPS/ParamActivity.html" title="class in utbm.tx52.suiviGPS"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?utbm/tx52/suiviGPS/\class-useParamActivity.html" target="_top"><B>FRAMES</B></A>
<A HREF="ParamActivity.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"content_hash": "202aed83b49ef5820a7d4dc106df9478",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 204,
"avg_line_length": 40.28169014084507,
"alnum_prop": 0.6006993006993007,
"repo_name": "almerino/Geolocation",
"id": "ff06532d2a638ed51cec4aebc117e20e80e4e401",
"size": "5720",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/utbm/tx52/suiviGPS/class-use/ParamActivity.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "63496"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NancyModules")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NancyModules")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bf641cc8-c25f-453b-9876-f070de1c9ec1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "18c659254fca9a2916d704e6825127ef",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.80555555555556,
"alnum_prop": 0.7451682176091625,
"repo_name": "cognisant/cr-cqrs-scaffold",
"id": "b6519f9417c0d8eb559bcdc5286bc271d9c2ad79",
"size": "1400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "widget-api/NancyModules/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "441"
},
{
"name": "C#",
"bytes": "46139"
},
{
"name": "F#",
"bytes": "3025"
},
{
"name": "PowerShell",
"bytes": "538"
}
],
"symlink_target": ""
} |
'use strict';
describe('Service: OMDb', function () {
// load the service's module
beforeEach(module('cinemaCercaApp'));
// instantiate service
var OMDb;
beforeEach(inject(function (_OMDb_) {
OMDb = _OMDb_;
}));
it('should do something', function () {
expect(!!OMDb).toBe(true);
});
});
| {
"content_hash": "7bf097f5d99a5f01776280deb6bdf75e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 41,
"avg_line_length": 17.555555555555557,
"alnum_prop": 0.6107594936708861,
"repo_name": "alefherrera/tp1-ing-soft",
"id": "59bdff533e31b089d7fe523f48d9c71ea9ce663f",
"size": "316",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CinemaCerca/client/app/OMDb/OMDb.service.spec.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "2822"
},
{
"name": "HTML",
"bytes": "13995"
},
{
"name": "JavaScript",
"bytes": "36990"
}
],
"symlink_target": ""
} |
var common = require ('../common/common');
var util = require('util');
var proxiedRequestTransport = require('@slack/client/lib/clients/transports/request.js').proxiedRequestTransport;
var wsTransport = require('@slack/client/lib/clients/transports/ws');
var RtmClient = require('@slack/client').RtmClient;
var token = common.config().slack_token || '';
var rtm = new RtmClient(
common.config().slack_token || '',
{
logLevel: common.config().loglevel,
transport: proxiedRequestTransport('http://10.110.8.42:8080'),
socketFn: function(socketUrl) {
return wsTransport(socketUrl, {
proxyURL: 'http://10.110.8.42:8080',
// there's a mistake in transport/ws.js that tries to use both "proxyURL" and "proxyUrl"
// so just submit both options for now as a temporary workaround.
proxyUrl: 'http://10.110.8.42:8080'
});
}
}
);
rtm.start();
var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;
rtm.on(CLIENT_EVENTS.RTM_AUTHENTICATED, function(rtmStartData){
console.log('RTM_AUTHENTICATED. Data:'+ util.inspect(rtmStartData));
});
| {
"content_hash": "b605c9f7ac6e653573dc581722e091a7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 113,
"avg_line_length": 35.0625,
"alnum_prop": 0.6737967914438503,
"repo_name": "golcinab/slacklistener",
"id": "218f2bed459d8b568f7a9af4a766881999de8e57",
"size": "1155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "testing/testingslackclient.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10243"
}
],
"symlink_target": ""
} |
title: afv45
type: products
image: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png
heading: v45
description: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj
main:
heading: Foo Bar BAz
description: |-
***This is i a thing***kjh hjk kj
# Blah Blah
## Blah
### Baah
image1:
alt: kkkk
---
| {
"content_hash": "6ad6ecddd59fcdc7cdcf0757cfa52c35",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6656716417910448,
"repo_name": "pblack/kaldi-hugo-cms-template",
"id": "919f9870e40ced4bb93b1005aeabd0c567b47813",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/content/pages2/afv45.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94394"
},
{
"name": "HTML",
"bytes": "18889"
},
{
"name": "JavaScript",
"bytes": "10014"
}
],
"symlink_target": ""
} |
//Problem 15. Hexadecimal to Decimal Number
//Using loops write a program that converts a hexadecimal integer number to its decimal form.
//The input is entered as string. The output should be a variable of type long.
//Do not use the built-in .NET functionality.
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
//string number = "ABC3";
Console.Write("Enter Number in HEX Format : ");
string number = Console.ReadLine();
List<long> listOfNumbers = new List<long>();
int countSystem = 16; // Count system we wanna use
long currentNumber = 0;
long result = 0;
for (int a = number.Length; a > 0; a--) // This reverses the binary number for reading from right to left
{
switch (number[a - 1]) // Checking if some value == A,B,C,D,E,F and transfer the actual dec value to it
{
case 'A':
currentNumber = 10;
break;
case 'B':
currentNumber = 11;
break;
case 'C':
currentNumber = 12;
break;
case 'D':
currentNumber = 13;
break;
case 'E':
currentNumber = 14;
break;
case 'F':
currentNumber = 15;
break;
default:
currentNumber = long.Parse((number[a - 1]).ToString()); // If it's not, than simply convert it to long
break;
}
listOfNumbers.Add(currentNumber); // and than add it to the dynamic list
}
for (int power = 0; power < listOfNumbers.Count; power++)
{
result += listOfNumbers[power] * OnPower(countSystem,power); // So by this formula we can get any count system by base
}
Console.WriteLine("result : " + result);
}
public static long OnPower(long number, long power) // Method returning the number X on power Y
{
long result = 1;
for (int i = 1; i <= power; i++)
{
result *= number;
}
return result;
}
}
| {
"content_hash": "0a9864418b6e216f8ba27b0289ed1bc8",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 130,
"avg_line_length": 34.68181818181818,
"alnum_prop": 0.508955875928353,
"repo_name": "siderisltd/Telerik-Academy",
"id": "8bb310483668eece5691390eb7447e0dac0689b5",
"size": "2291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "All Courses Homeworks/C#_Part_1/6. Loops/DecimalToHexadecimal/Program.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1027901"
},
{
"name": "CSS",
"bytes": "1076028"
},
{
"name": "CoffeeScript",
"bytes": "4962"
},
{
"name": "HTML",
"bytes": "701827"
},
{
"name": "JavaScript",
"bytes": "2830280"
},
{
"name": "Smalltalk",
"bytes": "66"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package una.examen.entity;
/**
*
* @author michaelcw02
*/
public class UserQuestion {
private UserQuestionID userQuestionID;
private Usuario usuario;
private Question question;
private Answer answer;
public UserQuestion(UserQuestionID userQuestionID, Usuario usuario, Question question, Answer answer) {
this.userQuestionID = userQuestionID;
this.usuario = usuario;
this.question = question;
this.answer = answer;
}
public UserQuestionID getUserQuestionID() {
return userQuestionID;
}
public void setUserQuestionID(UserQuestionID userQuestionID) {
this.userQuestionID = userQuestionID;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
public Question getQuestion() {
return question;
}
public void setQuestion(Question question) {
this.question = question;
}
public Answer getAnswer() {
return answer;
}
public void setAnswer(Answer answer) {
this.answer = answer;
}
}
| {
"content_hash": "e06177aa0ac9344f9b79521b934bb758",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 107,
"avg_line_length": 23.050847457627118,
"alnum_prop": 0.6463235294117647,
"repo_name": "michaelcw02/PrograIV",
"id": "29abeef235ae72073d0e1c94c284d6058f7fcbbb",
"size": "1360",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "II/Ex2Practica/Questions/src/java/una/examen/entity/UserQuestion.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1093896"
},
{
"name": "HTML",
"bytes": "14196646"
},
{
"name": "Java",
"bytes": "505953"
},
{
"name": "JavaScript",
"bytes": "5645658"
},
{
"name": "PHP",
"bytes": "451467"
},
{
"name": "PLSQL",
"bytes": "14578"
}
],
"symlink_target": ""
} |
package main
//Send to subscribe to events.
//MUST handle all passed to it until channel has successfully passed to Unsubscribe
var Subscribe = make(chan chan *Event)
//Send Conn to unsubscribe.
var Unsubscribe = make(chan chan *Event)
//Add an event to event queue.
var NewEvent = make(chan *Event)
//Event to update the value of a device.
type Event struct {
Source chan *Event
Name string
Value string
}
//Manager manages new connections, deleting connections, and broadcasting events
//to all of the current connections.
func Manager(devices []DeviceConfig) {
//Channel to get from the front of the event queue
NextEvent := make(chan *Event)
go func() {
//Event queue handled as an array. When a new event is present,
//append it, send the first available event over NextEvent.
//When there's no events left to send, reset the queue list to empty.
var queue []*Event
var next int
for {
if len(queue) == next {
next = 0
queue = queue[0:0]
queue = append(queue, <-NewEvent)
}
select {
case NextEvent <- queue[next]:
queue[next] = nil
next++
case add := <-NewEvent:
queue = append(queue, add)
}
}
}()
//Current state of each device
current := make(map[string]string)
for _, device := range devices {
current[device.GetName()] = device.GetInitial()
}
//Set of current connections.
subscriptions := make(map[chan *Event]struct{})
//Handle events forever
for {
select {
case conn := <-Subscribe:
subscriptions[conn] = struct{}{}
for name, val := range current {
conn <- &Event{nil, name, val}
}
case conn := <-Unsubscribe:
close(conn)
delete(subscriptions, conn)
case event := <-NextEvent:
current[event.Name] = event.Value
for subscription := range subscriptions {
subscription <- event
}
}
}
}
| {
"content_hash": "b3804474cb8d856d93864cbd814865d2",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 83,
"avg_line_length": 24.62162162162162,
"alnum_prop": 0.6745334796926454,
"repo_name": "Laremere/vrpn-webapp",
"id": "6d3793ed75896a503802546bbb09f035bdbfa990",
"size": "1822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "manager.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "729"
},
{
"name": "C++",
"bytes": "5169"
},
{
"name": "CSS",
"bytes": "36"
},
{
"name": "Go",
"bytes": "14261"
},
{
"name": "JavaScript",
"bytes": "3299"
}
],
"symlink_target": ""
} |
default_app_config = __name__ + '.apps.CollGatePrinter'
| {
"content_hash": "5bb1ef837ebe594f0ff09a93efe3b199",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 55,
"avg_line_length": 56,
"alnum_prop": 0.6964285714285714,
"repo_name": "coll-gate/collgate",
"id": "2381c09060fe900eca107c726d9cad79d5245814",
"size": "359",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/printer/__init__.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20334"
},
{
"name": "HTML",
"bytes": "245334"
},
{
"name": "JavaScript",
"bytes": "5131841"
},
{
"name": "Python",
"bytes": "1291968"
},
{
"name": "Shell",
"bytes": "126"
}
],
"symlink_target": ""
} |
package org.nd4j.linalg.dataset.api.preprocessor.classimbalance;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ops.random.impl.BernoulliDistribution;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.indexing.BooleanIndexing;
import org.nd4j.linalg.indexing.NDArrayIndex;
import org.nd4j.linalg.indexing.conditions.Conditions;
import org.nd4j.linalg.ops.transforms.Transforms;
public abstract class BaseUnderSamplingPreProcessor {
protected int tbpttWindowSize;
private boolean maskAllMajorityWindows = true;
private boolean donotMaskMinorityWindows = false;
/**
* If a tbptt segment is all majority class labels default behaviour is to mask all time steps in the segment.
* donotMaskAllMajorityWindows() will override the default and mask (1-targetDist)% of the time steps
*/
public void donotMaskAllMajorityWindows(){
this.maskAllMajorityWindows = false;
}
/**
* If set will not mask timesteps if they fall in a tbptt segment with at least one minority class label
*/
public void donotMaskMinorityWindows(){
this.donotMaskMinorityWindows = true;
}
public INDArray adjustMasks(INDArray label, INDArray labelMask, int minorityLabel, double targetDist) {
if (labelMask == null) {
labelMask = Nd4j.ones(label.size(0), label.size(2));
}
validateData(label,labelMask);
INDArray bernoullis = Nd4j.zeros(labelMask.shape());
int currentTimeSliceEnd = label.size(2);
//iterate over each tbptt window
while (currentTimeSliceEnd > 0) {
int currentTimeSliceStart = Math.max(currentTimeSliceEnd - tbpttWindowSize, 0);
//get views for current time slice
INDArray currentWindowBernoulli = bernoullis.get(NDArrayIndex.all(), NDArrayIndex.interval(currentTimeSliceStart, currentTimeSliceEnd));
INDArray currentMask = labelMask.get(NDArrayIndex.all(), NDArrayIndex.interval(currentTimeSliceStart, currentTimeSliceEnd));
INDArray currentLabel;
if (label.size(1) == 2) {
//if one hot grab the right index
currentLabel = label.get(NDArrayIndex.all(), NDArrayIndex.point(minorityLabel), NDArrayIndex.interval(currentTimeSliceStart, currentTimeSliceEnd));
} else {
currentLabel = label.get(NDArrayIndex.all(), NDArrayIndex.point(0), NDArrayIndex.interval(currentTimeSliceStart, currentTimeSliceEnd));
if (minorityLabel == 0) {
currentLabel = Transforms.not(currentLabel);
}
}
//calculate required probabilities and write into the view
currentWindowBernoulli.assign(calculateBernoulli(currentLabel, currentMask, targetDist));
currentTimeSliceEnd = currentTimeSliceStart;
}
return Nd4j.getExecutioner().exec(new BernoulliDistribution(Nd4j.createUninitialized(bernoullis.shape()), bernoullis), Nd4j.getRandom());
}
/*
Given a list of labels return the bernoulli prob that the masks
will be sampled at to meet the target minority label distribution
Masks at time steps where label is the minority class will always be one
i.e a bernoulli with p = 1
Masks at time steps where label is the majority class will be sampled from
a bernoulli dist with p
= (minorityCount/majorityCount) * ((1-targetDist)/targetDist)
*/
private INDArray calculateBernoulli(INDArray minorityLabels, INDArray labelMask, double targetMinorityDist) {
INDArray minorityClass = minorityLabels.dup().muli(labelMask);
INDArray majorityClass = Transforms.not(minorityLabels).muli(labelMask);
//all minorityLabel class, keep masks as is
//presence of minoriy class and donotmask minority windows set to true return label as is
if (majorityClass.sumNumber().intValue() == 0 || (minorityClass.sumNumber().intValue() > 0 && donotMaskMinorityWindows)) return labelMask;
//all majority class and set to not mask all majority windows sample majority class by 1-targetMinorityDist
if (minorityClass.sumNumber().intValue() == 0 && !maskAllMajorityWindows) return labelMask.muli(1-targetMinorityDist);
//Probabilities to be used for bernoulli sampling
INDArray minoritymajorityRatio = minorityClass.sum(1).div(majorityClass.sum(1));
INDArray majorityBernoulliP = minoritymajorityRatio.muli(1 - targetMinorityDist).divi(targetMinorityDist);
BooleanIndexing.replaceWhere(majorityBernoulliP,1.0, Conditions.greaterThan(1.0)); //if minority ratio is already met round down to 1.0
return majorityClass.muliColumnVector(majorityBernoulliP).addi(minorityClass);
}
private void validateData(INDArray label,INDArray labelMask) {
if (label.rank() != 3) {
throw new IllegalArgumentException("UnderSamplingByMaskingPreProcessor can only be applied to a time series dataset");
}
if (label.size(1) > 2) {
throw new IllegalArgumentException("UnderSamplingByMaskingPreProcessor can only be applied to labels that represent binary classes. Label size was found to be " + label.size(1) + ".Expecting size=1 or size=2.");
}
if (label.size(1) == 2) {
//check if label is of size one hot
if (!label.sum(1).mul(labelMask).equals(labelMask)) {
throw new IllegalArgumentException("Labels of size minibatchx2xtimesteps are expected to be one hot." + label.toString() + "\n is not one-hot");
}
}
}
}
| {
"content_hash": "7fac6118c3274b44e2e890ef88349621",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 223,
"avg_line_length": 50.36607142857143,
"alnum_prop": 0.7014713703244105,
"repo_name": "huitseeker/nd4j",
"id": "b30b11ba5aeae0e900e28ce4aba0d301e66b1448",
"size": "5641",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/classimbalance/BaseUnderSamplingPreProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "8354999"
},
{
"name": "Shell",
"bytes": "12216"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "2cfca861bf5d782e52eb3fa0d13fa70f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "26f5ccfb48fed8870d08dd088a4e154811f4f128",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Dalbergia/Dalbergia debilis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
'use strict';
class SettingsController {
constructor(Auth) {
this.errors = {};
this.submitted = false;
this.Auth = Auth;
}
changePassword(form) {
this.submitted = true;
if (form.$valid) {
this.Auth.changePassword(this.user.oldPassword, this.user.newPassword)
.then(() => {
this.message = 'Password successfully changed.';
})
.catch(() => {
form.password.$setValidity('mongoose', false);
this.errors.other = 'Incorrect password';
this.message = '';
});
}
}
}
angular.module('lakhaanaApp')
.controller('SettingsController', SettingsController);
| {
"content_hash": "7d84bda250a9caa70322f54bee369d0e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 22.75862068965517,
"alnum_prop": 0.5893939393939394,
"repo_name": "Khushmeet/lakhaan",
"id": "5ae3ce5c7b23d3fb083336cf9633d7e0d2839e43",
"size": "660",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "_site/client/app/account/settings/settings.controller.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "48278"
},
{
"name": "CSS",
"bytes": "9271"
},
{
"name": "HTML",
"bytes": "59578"
},
{
"name": "JavaScript",
"bytes": "238233"
}
],
"symlink_target": ""
} |
const parser = require('./parser');
const prettyData = require('gulp-pretty-data');
module.exports = parser([
prettyData({
type: 'minify'
})
]);
| {
"content_hash": "f6cc44c1fe8c6e9a27528c4b075b00bb",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 47,
"avg_line_length": 18.75,
"alnum_prop": 0.66,
"repo_name": "voorhoede/fastatic",
"id": "af4b0d65c65004e9d66f394356ebd900c05055b0",
"size": "150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/parse-jsonmin.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "14502"
},
{
"name": "Shell",
"bytes": "1110"
}
],
"symlink_target": ""
} |
package file
import (
"math"
"math/bits"
"unsafe"
"github.com/apache/arrow/go/v8/parquet"
"github.com/apache/arrow/go/v8/parquet/internal/bmi"
"github.com/apache/arrow/go/v8/parquet/internal/utils"
"github.com/apache/arrow/go/v8/parquet/schema"
"golang.org/x/xerrors"
)
type LevelInfo struct {
// How many slots an undefined but present (i.e. null) element in
// parquet consumes when decoding to Arrow.
// "Slot" is used in the same context as the Arrow specification
// (i.e. a value holder).
// This is only ever >1 for descendents of FixedSizeList.
NullSlotUsage int32
// The definition level at which the value for the field
// is considered not null (definition levels greater than
// or equal to this value indicate a not-null
// value for the field). For list fields definition levels
// greater than or equal to this field indicate a present,
// possibly null, child value.
DefLevel int16
// The repetition level corresponding to this element
// or the closest repeated ancestor. Any repetition
// level less than this indicates either a new list OR
// an empty list (which is determined in conjunction
// with definition levels).
RepLevel int16
// The definition level indicating the level at which the closest
// repeated ancestor is not empty. This is used to discriminate
// between a value less than |def_level| being null or excluded entirely.
// For instance if we have an arrow schema like:
// list(struct(f0: int)). Then then there are the following
// definition levels:
// 0 = null list
// 1 = present but empty list.
// 2 = a null value in the list
// 3 = a non null struct but null integer.
// 4 = a present integer.
// When reconstructing, the struct and integer arrays'
// repeated_ancestor_def_level would be 2. Any
// def_level < 2 indicates that there isn't a corresponding
// child value in the list.
// i.e. [null, [], [null], [{f0: null}], [{f0: 1}]]
// has the def levels [0, 1, 2, 3, 4]. The actual
// struct array is only of length 3: [not-set, set, set] and
// the int array is also of length 3: [N/A, null, 1].
RepeatedAncestorDefLevel int16
}
func newDefaultLevelInfo() *LevelInfo {
return &LevelInfo{NullSlotUsage: 1}
}
func (l *LevelInfo) Equal(rhs *LevelInfo) bool {
return l.NullSlotUsage == rhs.NullSlotUsage &&
l.DefLevel == rhs.DefLevel &&
l.RepLevel == rhs.RepLevel &&
l.RepeatedAncestorDefLevel == rhs.RepeatedAncestorDefLevel
}
func (l *LevelInfo) HasNullableValues() bool {
return l.RepeatedAncestorDefLevel < l.DefLevel
}
func (l *LevelInfo) IncrementOptional() {
l.DefLevel++
}
func (l *LevelInfo) IncrementRepeated() int16 {
lastRepAncestor := l.RepeatedAncestorDefLevel
// Repeated fields add both a repetition and definition level. This is used
// to distinguish between an empty list and a list with an item in it.
l.RepLevel++
l.DefLevel++
// For levels >= repeated_ancenstor_def_level it indicates the list was
// non-null and had at least one element. This is important
// for later decoding because we need to add a slot for these
// values. for levels < current_def_level no slots are added
// to arrays.
l.RepeatedAncestorDefLevel = l.DefLevel
return lastRepAncestor
}
func (l *LevelInfo) Increment(n schema.Node) {
switch n.RepetitionType() {
case parquet.Repetitions.Repeated:
l.IncrementRepeated()
case parquet.Repetitions.Optional:
l.IncrementOptional()
}
}
// Input/Output structure for reconstructed validity bitmaps.
type ValidityBitmapInputOutput struct {
// Input only.
// The maximum number of values_read expected (actual
// values read must be less than or equal to this value).
// If this number is exceeded methods will throw a
// ParquetException. Exceeding this limit indicates
// either a corrupt or incorrectly written file.
ReadUpperBound int64
// Output only. The number of values added to the encountered
// (this is logically the count of the number of elements
// for an Arrow array).
Read int64
// Input/Output. The number of nulls encountered.
NullCount int64
// Output only. The validity bitmap to populate. May be be null only
// for DefRepLevelsToListInfo (if all that is needed is list offsets).
ValidBits []byte
// Input only, offset into valid_bits to start at.
ValidBitsOffset int64
}
// create a bitmap out of the definition Levels and return the number of non-null values
func defLevelsBatchToBitmap(defLevels []int16, remainingUpperBound int64, info LevelInfo, wr utils.BitmapWriter, hasRepeatedParent bool) (count uint64) {
const maxbatch = 8 * int(unsafe.Sizeof(uint64(0)))
if !hasRepeatedParent && int64(len(defLevels)) > remainingUpperBound {
panic("values read exceed upper bound")
}
var batch []int16
for len(defLevels) > 0 {
batchSize := utils.MinInt(maxbatch, len(defLevels))
batch, defLevels = defLevels[:batchSize], defLevels[batchSize:]
definedBitmap := bmi.GreaterThanBitmap(batch, info.DefLevel-1)
if hasRepeatedParent {
// Greater than level_info.repeated_ancestor_def_level - 1 implies >= the
// repeated_ancestor_def_level
presentBitmap := bmi.GreaterThanBitmap(batch, info.RepeatedAncestorDefLevel-1)
selectedBits := bmi.ExtractBits(definedBitmap, presentBitmap)
selectedCount := int64(bits.OnesCount64(presentBitmap))
if selectedCount > remainingUpperBound {
panic("values read exceeded upper bound")
}
wr.AppendWord(selectedBits, selectedCount)
count += uint64(bits.OnesCount64(selectedBits))
continue
}
wr.AppendWord(definedBitmap, int64(len(batch)))
count += uint64(bits.OnesCount64(definedBitmap))
}
return
}
// create a bitmap out of the definition Levels
func defLevelsToBitmapInternal(defLevels []int16, info LevelInfo, out *ValidityBitmapInputOutput, hasRepeatedParent bool) {
wr := utils.NewFirstTimeBitmapWriter(out.ValidBits, out.ValidBitsOffset, int64(len(defLevels)))
defer wr.Finish()
setCount := defLevelsBatchToBitmap(defLevels, out.ReadUpperBound, info, wr, hasRepeatedParent)
out.Read = int64(wr.Pos())
out.NullCount += out.Read - int64(setCount)
}
// DefLevelsToBitmap creates a validitybitmap out of the passed in definition levels and info object.
func DefLevelsToBitmap(defLevels []int16, info LevelInfo, out *ValidityBitmapInputOutput) {
hasRepeatedParent := false
if info.RepLevel > 0 {
hasRepeatedParent = true
}
defLevelsToBitmapInternal(defLevels, info, out, hasRepeatedParent)
}
// DefRepLevelsToListInfo takes in the definition and repetition levels in order to populate the validity bitmap
// and properly handle nested lists and update the offsets for them.
func DefRepLevelsToListInfo(defLevels, repLevels []int16, info LevelInfo, out *ValidityBitmapInputOutput, offsets []int32) error {
var wr utils.BitmapWriter
if out.ValidBits != nil {
wr = utils.NewFirstTimeBitmapWriter(out.ValidBits, out.ValidBitsOffset, out.ReadUpperBound)
defer wr.Finish()
}
offsetPos := 0
for idx := range defLevels {
// skip items that belong to empty or null ancestor lists and further nested lists
if defLevels[idx] < info.RepeatedAncestorDefLevel || repLevels[idx] > info.RepLevel {
continue
}
if repLevels[idx] == info.RepLevel {
// continuation of an existing list.
// offsets can be null for structs with repeated children
if offsetPos < len(offsets) {
if offsets[offsetPos] == math.MaxInt32 {
return xerrors.New("list index overflow")
}
offsets[offsetPos]++
}
} else {
if (wr != nil && int64(wr.Pos()) >= out.ReadUpperBound) || (offsetPos >= int(out.ReadUpperBound)) {
return xerrors.Errorf("definition levels exceeded upper bound: %d", out.ReadUpperBound)
}
// current_rep < list rep_level i.e. start of a list (ancestor empty lists
// are filtered out above)
// offsets can be null for structs with repeated children
if offsetPos+1 < len(offsets) {
offsetPos++
// use cumulative offsets because variable size lists are more common
// than fixed size lists so it should be cheaper to make these
// cumulative and subtract when validating fixed size lists
offsets[offsetPos] = offsets[offsetPos-1]
if defLevels[idx] >= info.DefLevel {
if offsets[offsetPos] == math.MaxInt32 {
return xerrors.New("list index overflow")
}
offsets[offsetPos]++
}
}
if wr != nil {
// the level info def level for lists reflects element present level
// the prior level distinguishes between empty lists
if defLevels[idx] >= info.DefLevel-1 {
wr.Set()
} else {
out.NullCount++
wr.Clear()
}
wr.Next()
}
}
}
if len(offsets) > 0 {
out.Read = int64(offsetPos)
} else if wr != nil {
out.Read = int64(wr.Pos())
}
if out.NullCount > 0 && info.NullSlotUsage > 1 {
return xerrors.New("null values with null_slot_usage > 1 not supported.")
}
return nil
}
// DefRepLevelsToBitmap constructs a full validitybitmap out of the definition and repetition levels
// properly handling nested lists and parents.
func DefRepLevelsToBitmap(defLevels, repLevels []int16, info LevelInfo, out *ValidityBitmapInputOutput) error {
info.RepLevel++
info.DefLevel++
return DefRepLevelsToListInfo(defLevels, repLevels, info, out, nil)
}
| {
"content_hash": "1ea7dab55aac29071a333dcd2004c3c4",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 153,
"avg_line_length": 36.39525691699605,
"alnum_prop": 0.7296915725456126,
"repo_name": "laurentgo/arrow",
"id": "8c8f360f58005e770f4a685247aaed3238554861",
"size": "10004",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "go/parquet/file/level_conversion.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "73655"
},
{
"name": "Awk",
"bytes": "3683"
},
{
"name": "Batchfile",
"bytes": "32252"
},
{
"name": "C",
"bytes": "328114"
},
{
"name": "C#",
"bytes": "419434"
},
{
"name": "C++",
"bytes": "7254875"
},
{
"name": "CMake",
"bytes": "401649"
},
{
"name": "CSS",
"bytes": "3946"
},
{
"name": "Dockerfile",
"bytes": "42193"
},
{
"name": "FreeMarker",
"bytes": "2274"
},
{
"name": "Go",
"bytes": "364102"
},
{
"name": "HTML",
"bytes": "23047"
},
{
"name": "Java",
"bytes": "2296962"
},
{
"name": "JavaScript",
"bytes": "84850"
},
{
"name": "Lua",
"bytes": "8741"
},
{
"name": "M4",
"bytes": "8713"
},
{
"name": "MATLAB",
"bytes": "9068"
},
{
"name": "Makefile",
"bytes": "44853"
},
{
"name": "Meson",
"bytes": "36931"
},
{
"name": "Objective-C",
"bytes": "7559"
},
{
"name": "PLpgSQL",
"bytes": "56995"
},
{
"name": "Perl",
"bytes": "3799"
},
{
"name": "Python",
"bytes": "1548489"
},
{
"name": "R",
"bytes": "155922"
},
{
"name": "Ruby",
"bytes": "682150"
},
{
"name": "Rust",
"bytes": "1609482"
},
{
"name": "Shell",
"bytes": "251436"
},
{
"name": "Thrift",
"bytes": "137291"
},
{
"name": "TypeScript",
"bytes": "932690"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "9495aa96e54dcfb072078465142fe7ac",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "cf548cc90c3e5cdcd243db548c44df1ef8cecab8",
"size": "172",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Amaranthaceae/Euxolus/Euxolus oleraceus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html itemscope lang="en-us">
<head><meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="generator" content="Hugo 0.57.2" />
<meta property="og:title" content="Something Isn't Right Here." />
<meta name="twitter:title" content="Something isn't right here."/>
<meta itemprop="name" content="Something isn't right here."><meta property="og:description" content="It’s adventure time as we go on an investigative journey in debugging one of our services to uncover the underlying root cause of excessive CPU usage." />
<meta name="twitter:description" content="It’s adventure time as we go on an investigative journey in debugging one of our services to uncover the underlying root cause of excessive CPU usage." />
<meta itemprop="description" content="It’s adventure time as we go on an investigative journey in debugging one of our services to uncover the underlying root cause of excessive CPU usage."><meta name="twitter:site" content="@devopsdays">
<meta property="og:type" content="talk" />
<meta property="og:url" content="/events/2017-cape-town/program/duncan-phillips/" /><meta name="twitter:creator" content="@devopsdayscpt" /><meta name="twitter:label1" value="Event" />
<meta name="twitter:data1" value="devopsdays Cape Town 2017" /><meta name="twitter:label2" value="Dates" />
<meta name="twitter:data2" value="November 6 - 7, 2017" /><meta property="og:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta itemprop="image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta property="fb:app_id" content="1904065206497317" /><meta itemprop="wordCount" content="26">
<title>Something isn't right here. - devopsdays Cape Town 2017
</title>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-9713393-1', 'auto');
ga('send', 'pageview');
ga('create', 'UA-105986234-1', 'auto', 'clientTracker');
ga('clientTracker.send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<link href="/css/site.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet"><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="/events/index.xml" rel="alternate" type="application/rss+xml" title="DevOpsDays" />
<link href="/events/index.xml" rel="feed" type="application/rss+xml" title="DevOpsDays" />
<script src=/js/devopsdays-min.js></script></head>
<body lang="">
<nav class="navbar navbar-expand-md navbar-light">
<a class="navbar-brand" href="/">
<img src="/img/devopsdays-brain.png" height="30" class="d-inline-block align-top" alt="devopsdays Logo">
DevOpsDays
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"><li class="nav-item global-navigation"><a class = "nav-link" href="/events">events</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/blog">blog</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/sponsor">sponsor</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/speaking">speaking</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/organizing">organizing</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/about">about</a></li></ul>
</div>
</nav>
<nav class="navbar event-navigation navbar-expand-md navbar-light">
<a href="/events/2017-cape-town" class="nav-link">Cape Town</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar2">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbar2">
<ul class="navbar-nav"><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/location">location</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/program">program</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/speakers">speakers</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/sponsor">sponsor</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/contact">contact</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2017-cape-town/conduct">conduct</a>
</li></ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-12"><div class = "row">
<div class = "col-md-5 offset-md-1">
<h2 class="talk-page">Something isn't right here.</h2><div class="row">
<div class="col-md-12 youtube-video">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/ZtpeidC6vII">
</iframe>
</div>
</div>
</div><br /><br /><br />
<span class="talk-page content-text">
<p>It’s adventure time as we go on an investigative journey in debugging one of our services to uncover the underlying root cause of excessive CPU usage.</p>
</span><div class = "row">
<div class = "col" style="max-width:100%">
<h2 class="talk-page">Speakerdeck</h2>
<a class="embedly-card" data-card-controls="0" href="https://speakerdeck.com/duncanphillips/something-isnt-right-here">Something isn't right here.</a>
<script async src="//cdn.embedly.com/widgets/platform.js" charset="UTF-8"></script>
</div>
</div></div>
<div class = "col-md-3 offset-md-1"><h2 class="talk-page">Speaker</h2><img src = "/events/2017-cape-town/speakers/duncan-phillips.jpg" class="img-fluid" alt="duncan-phillips"/><br /><br /><h4 class="talk-page"><a href = "/events/2017-cape-town/speakers/duncan-phillips">
Duncan Phillips
</a></h4><br />
<span class="talk-page content-text">Duncan is an Engineering Director for Platform at takealot.com and one of the co-founders for ScaleConf. He works tirelessly to automate his job away, but has yet to realize that dream.</span>
</div>
</div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Platinum Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://sites.elasticgrid.com/atlassian/devops-aw/obsidianza/"><img src = "/img/sponsors/obsidian.png" alt = "Obsidian" title = "Obsidian" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Gold Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://bit.ly/2xBHNm9"><img src = "/img/sponsors/offerzen.png" alt = "OfferZen" title = "OfferZen" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.microsoft.com/"><img src = "/img/sponsors/microsoft.png" alt = "Microsoft" title = "Microsoft" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://gocd.org/"><img src = "/img/sponsors/thoughtworks-gocd-before-20190213.png" alt = "GoCD" title = "GoCD" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://zappistore.com/"><img src = "/img/sponsors/zappistore.png" alt = "ZappiStore" title = "ZappiStore" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Basic Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.ca.com/content/dam/ca/us/files/industry-analyst-report/continuous-testing-as-a-digital-business-enabler.pdf"><img src = "/img/sponsors/ca-tech-za.png" alt = "CA Technologies" title = "CA Technologies" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Community Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.lpi.org/"><img src = "/img/sponsors/lpi-za.png" alt = "LPI Southern Africa" title = "LPI Southern Africa" class="img-fluid"></a>
</div></div><br />
</div></div>
</div>
<nav class="navbar bottom navbar-light footer-nav-row" style="background-color: #bfbfc1;">
<div class = "row">
<div class = "col-md-12 footer-nav-background">
<div class = "row">
<div class = "col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">@DEVOPSDAYS</h3>
<div>
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/devopsdays/lists/devopsdays" data-chrome="noheader" height="440"></a>
<script>
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");
</script>
</div>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col footer-content">
<h3 class="footer-nav">BLOG</h3><a href = "https://www.devopsdays.org/blog/2019/05/10/10-years-of-devopsdays/"><h1 class = "footer-heading">10 years of devopsdays</h1></a><h2 class="footer-heading">by Kris Buytaert - 10 May, 2019</h2><p class="footer-content">It’s hard to believe but it is almost 10 years ago since #devopsdays happened for the first time in Gent. Back then there were almost 70 of us talking about topics that were of interest to both Operations and Development, we were exchanging our ideas and experiences `on how we were improving the quality of software delivery.
Our ideas got started on the crossroads of Open Source, Agile and early Cloud Adoption.</p><a href = "https://www.devopsdays.org/blog/"><h1 class = "footer-heading">Blogs</h1></a><h2 class="footer-heading">10 May, 2019</h2><p class="footer-content"></p><a href="https://www.devopsdays.org/blog/index.xml">Feed</a>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">CFP OPEN</h3><a href = "/events/2019-campinas" class = "footer-content">Campinas</a><br /><a href = "/events/2019-macapa" class = "footer-content">Macapá</a><br /><a href = "/events/2019-shanghai" class = "footer-content">Shanghai</a><br /><a href = "/events/2019-recife" class = "footer-content">Recife</a><br /><a href = "/events/2020-charlotte" class = "footer-content">Charlotte</a><br /><a href = "/events/2020-prague" class = "footer-content">Prague</a><br /><a href = "/events/2020-tokyo" class = "footer-content">Tokyo</a><br /><a href = "/events/2020-salt-lake-city" class = "footer-content">Salt Lake City</a><br />
<br />Propose a talk at an event near you!<br />
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">About</h3>
devopsdays is a worldwide community conference series for anyone interested in IT improvement.<br /><br />
<a href="/about/" class = "footer-content">About devopsdays</a><br />
<a href="/privacy/" class = "footer-content">Privacy Policy</a><br />
<a href="/conduct/" class = "footer-content">Code of Conduct</a>
<br />
<br />
<a href="https://www.netlify.com">
<img src="/img/netlify-light.png" alt="Deploys by Netlify">
</a>
</div>
</div>
</div>
</div>
</nav>
<script>
$(document).ready(function () {
$("#share").jsSocials({
shares: ["email", {share: "twitter", via: 'devopsdayscpt'}, "facebook", "linkedin"],
text: 'devopsdays Cape Town - 2017',
showLabel: false,
showCount: false
});
});
</script>
</body>
</html>
| {
"content_hash": "03cad9662c99070829b6e8f9e64d5e99",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 654,
"avg_line_length": 62.92511013215859,
"alnum_prop": 0.6407868944273313,
"repo_name": "gomex/devopsdays-web",
"id": "79f065bfae0344e83a3daa158498fe090fd93b9b",
"size": "14285",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "static/events/2017-cape-town/program/duncan-phillips/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1568"
},
{
"name": "HTML",
"bytes": "1937025"
},
{
"name": "JavaScript",
"bytes": "14313"
},
{
"name": "PowerShell",
"bytes": "291"
},
{
"name": "Ruby",
"bytes": "650"
},
{
"name": "Shell",
"bytes": "12282"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "3009a4a435fa96f6045d8b4bcd555b17",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "df641c9a89a11c61880951f44933c573ffa976da",
"size": "177",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Lamiaceae/Hemiandra/Hemiandra brevifolia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using namespace aliyun;
namespace {
void Json2Type(const Json::Value& value, std::string* item);
void Json2Type(const Json::Value& value, AlertUpdateContactResponseType* item);
template<typename T>
class Json2Array {
public:
Json2Array(const Json::Value& value, std::vector<T>* vec) {
if(!value.isArray()) {
return;
}
for(int i = 0; i < value.size(); i++) {
T val;
Json2Type(value[i], &val);
vec->push_back(val);
}
}
};
void Json2Type(const Json::Value& value, std::string* item) {
*item = value.asString();
}
void Json2Type(const Json::Value& value, AlertUpdateContactResponseType* item) {
if(value.isMember("code")) {
item->code = value["code"].asString();
}
if(value.isMember("message")) {
item->message = value["message"].asString();
}
if(value.isMember("success")) {
item->success = value["success"].asString();
}
if(value.isMember("traceId")) {
item->trace_id = value["traceId"].asString();
}
}
}
int Alert::UpdateContact(const AlertUpdateContactRequestType& req,
AlertUpdateContactResponseType* response,
AlertErrorInfo* error_info) {
std::string str_response;
int status_code;
int ret = 0;
bool parse_success = false;
Json::Value val;
Json::Reader reader;
std::string secheme = this->use_tls_ ? "https" : "http";
std::string url = secheme + "://" + host_ + get_format_string("/projects/%s/contacts/%s", req.project_name.c_str(), req.contact_name.c_str());
AliRoaRequest* req_rpc = new AliRoaRequest(version_,
appid_,
secret_,
url);
if((!this->use_tls_) && this->proxy_host_ && this->proxy_host_[0]) {
req_rpc->SetHttpProxy( this->proxy_host_);
}
req_rpc->setRequestMethod("PUT");
if(req_rpc->CommitRequestWithBody(req.contact) != 0) {
if(error_info) {
error_info->code = "connect to host failed";
}
ret = -1;
goto out;
}
status_code = req_rpc->WaitResponseHeaderComplete();
req_rpc->ReadResponseBody(str_response);
if(status_code > 0 && !str_response.empty()){
parse_success = reader.parse(str_response, val);
}
if(!parse_success) {
if(error_info) {
error_info->code = "parse response failed";
}
ret = -1;
goto out;
}
if(status_code!= 200 && error_info) {
error_info->request_id = val.isMember("RequestId") ? val["RequestId"].asString(): "";
error_info->code = val.isMember("Code") ? val["Code"].asString(): "";
error_info->host_id = val.isMember("HostId") ? val["HostId"].asString(): "";
error_info->message = val.isMember("Message") ? val["Message"].asString(): "";
}
if(status_code== 200 && response) {
Json2Type(val, response);
}
ret = status_code;
out:
delete req_rpc;
return ret;
}
| {
"content_hash": "9414b1b23e7f4a823f3efec1f0a26d46",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 145,
"avg_line_length": 31.72826086956522,
"alnum_prop": 0.5895854744775608,
"repo_name": "aliyun-beta/aliyun-openapi-cpp-sdk",
"id": "4ab689894e63ced5413d86c5ca8942d42525626b",
"size": "3072",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "aliyun-api-alert/2015-08-15/src/ali_alert_update_contact.cc",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "887"
},
{
"name": "C++",
"bytes": "5366614"
},
{
"name": "CMake",
"bytes": "54920"
}
],
"symlink_target": ""
} |
import os
from setuptools import setup, find_packages
from pip.req import parse_requirements
from pip.download import PipSession
version = '0.9.0b'
def read(f):
return open(os.path.join(os.path.dirname(__file__), f)).read().strip()
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
description = read('README.md')
install_reqs = parse_requirements('requirements.txt', session=PipSession())
reqs = [str(ir.req) for ir in install_reqs]
setup(name='tuneharvest',
version=version,
description='A tool to harvest links from slack into youtube playlists',
long_description=description,
classifiers=[
'License :: OSI Approved :: MIT License',
'Intended Audience :: Other Audience',
'Programming Language :: Python :: 3'],
author='K.C.Saff',
author_email='kc@saff.net',
url='https://github.com/kcsaff/tuneharvest',
license='MIT',
packages=find_packages(),
install_requires=[
'slacker>=0.9.0',
'parse>=1.6.6',
'google-api-python-client>=1.5.0',
],
entry_points={
'console_scripts': ['tuneharvest = tuneharvest:main']
},
include_package_data=False,
)
| {
"content_hash": "6617867ea253952245106198ce27de59",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.636650868878357,
"repo_name": "kcsaff/tuneharvest",
"id": "548ce912729aededce989170fe10a0459604016a",
"size": "1266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "173"
},
{
"name": "Python",
"bytes": "26144"
}
],
"symlink_target": ""
} |
PREREQUISITES:
* Some familiarity with C++.
* Must have [downloaded TensorFlow source](../../get_started/index.md#source),
and be able to build it.
If you'd like to incorporate an operation that isn't covered by the existing
library, you can create a custom Op. To incorporate your custom Op, you'll need
to:
* Register the new Op in a C++ file. The Op registration is independent of the
implementation, and describes the semantics of how the Op is invoked. For
example, it defines the Op name, and specifies its inputs and outputs.
* Implement the Op in C++. This implementation is called a "kernel", and there
can be multiple kernels for different architectures (e.g. CPUs, GPUs) or
input / output types.
* Create a Python wrapper. This wrapper is the public API to create the Op. A
default wrapper is generated from the Op registration, which can be used
directly or added to.
* Optionally, write a function to compute gradients for the Op.
* Optionally, write a function that describes the input and output shapes
for the Op. This allows shape inference to work with your Op.
* Test the Op, typically in Python.
<!-- TOC-BEGIN This section is generated by neural network: DO NOT EDIT! -->
## Contents
### [Adding a New Op](#AUTOGENERATED-adding-a-new-op)
* [Define the Op's interface](#define_interface)
* [Implement the kernel for the Op](#AUTOGENERATED-implement-the-kernel-for-the-op)
* [Generate the client wrapper](#AUTOGENERATED-generate-the-client-wrapper)
* [The Python Op wrapper](#AUTOGENERATED-the-python-op-wrapper)
* [The C++ Op wrapper](#AUTOGENERATED-the-c---op-wrapper)
* [Verify it works](#AUTOGENERATED-verify-it-works)
* [Validation](#Validation)
* [Op registration](#AUTOGENERATED-op-registration)
* [Attrs](#Attrs)
* [Attr types](#AUTOGENERATED-attr-types)
* [Polymorphism](#Polymorphism)
* [Inputs and Outputs](#AUTOGENERATED-inputs-and-outputs)
* [Backwards compatibility](#AUTOGENERATED-backwards-compatibility)
* [GPU Support](#mult-archs)
* [Implement the gradient in Python](#AUTOGENERATED-implement-the-gradient-in-python)
* [Implement a shape function in Python](#AUTOGENERATED-implement-a-shape-function-in-python)
<!-- TOC-END This section was generated by neural network, THANKS FOR READING! -->
## Define the Op's interface <a class="md-anchor" id="define_interface"></a>
You define the interface of an Op by registering it with the TensorFlow system.
In the registration, you specify the name of your Op, its inputs (types and
names) and outputs (types and names), as well as docstrings and
any [attrs](#Attrs) the Op might require.
To see how this works, suppose you'd like to create an Op that takes a tensor of
`int32`s and outputs a copy of the tensor, with all but the first element set to
zero. Create file [`tensorflow/core/user_ops`][user_ops]`/zero_out.cc` and
add a call to the `REGISTER_OP` macro that defines the interface for such an Op:
```c++
#include "tensorflow/core/framework/op.h"
REGISTER_OP("ZeroOut")
.Input("to_zero: int32")
.Output("zeroed: int32");
```
This `ZeroOut` Op takes one tensor `to_zero` of 32-bit integers as input, and
outputs a tensor `zeroed` of 32-bit integers.
> A note on naming: The name of the Op should be unique and CamelCase. Names
> starting with an underscore (`_`) are reserved for internal use.
## Implement the kernel for the Op <a class="md-anchor" id="AUTOGENERATED-implement-the-kernel-for-the-op"></a>
After you define the interface, provide one or more implementations of the Op.
To create one of these kernels, create a class that extends `OpKernel` and
overrides the `Compute` method. The `Compute` method provides one `context`
argument of type `OpKernelContext*`, from which you can access useful things
like the input and output tensors.
Add your kernel to the file you created above. The kernel might look something
like this:
```c++
#include "tensorflow/core/framework/op_kernel.h"
using namespace tensorflow;
class ZeroOutOp : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {}
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
auto input = input_tensor.flat<int32>();
// Create an output tensor
Tensor* output_tensor = NULL;
OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(),
&output_tensor));
auto output = output_tensor->template flat<int32>();
// Set all but the first element of the output tensor to 0.
const int N = input.size();
for (int i = 1; i < N; i++) {
output(i) = 0;
}
// Preserve the first input value if possible.
if (N > 0) output(0) = input(0);
}
};
```
After implementing your kernel, you register it with the TensorFlow system. In
the registration, you specify different constraints under which this kernel
will run. For example, you might have one kernel made for CPUs, and a separate
one for GPUs.
To do this for the `ZeroOut` op, add the following to `zero_out.cc`:
```c++
REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp);
```
Once you
[build and reinstall TensorFlow](../../get_started/os_setup.md#create-pip), the
Tensorflow system can reference and use the Op when requested.
## Generate the client wrapper <a class="md-anchor" id="AUTOGENERATED-generate-the-client-wrapper"></a>
### The Python Op wrapper <a class="md-anchor" id="AUTOGENERATED-the-python-op-wrapper"></a>
Python op wrappers are created automatically in
`bazel-genfiles/tensorflow/python/ops/gen_user_ops.py` for all ops placed in the
[`tensorflow/core/user_ops`][user_ops] directory when you build Tensorflow.
> Note: The generated function will be given a snake_case name (to comply with
> [PEP8](https://www.python.org/dev/peps/pep-0008/)). So if your op is named
> `ZeroOut` in the C++ files, the python function will be called `zero_out`.
Those ops are imported into
[`tensorflow/python/user_ops/user_ops.py`][python-user_ops] with the statement:
```python
from tensorflow.python.ops.gen_user_ops import *
```
You may optionally use your own function instead. To do this, you first hide
the generated code for that op by adding its name to the `hidden` list in the
`"user_ops"` rule in
[`tensorflow/python/BUILD`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/BUILD):
```python
tf_gen_op_wrapper_py(
name = "user_ops",
hidden = [
"Fact",
],
require_shape_functions = False,
)
```
List your op next to `"Fact"`. Next you add your replacement function to
[`tensorflow/python/user_ops/user_ops.py`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/user_ops/user_ops.py).
Typically your function will call the generated function to actually add the op
to the graph. The hidden version of the generated function will be in the
`gen_user_ops` package and start with an underscore ("`_`"). For example:
```python
def my_fact():
"""Example of overriding the generated code for an Op."""
return gen_user_ops._fact()
```
### The C++ Op wrapper <a class="md-anchor" id="AUTOGENERATED-the-c---op-wrapper"></a>
C++ op wrappers are created automatically for all ops placed in the
[`tensorflow/core/user_ops`][user_ops] directory, when you build Tensorflow. For
example, ops in `tensorflow/core/user_ops/zero_out.cc` will generate wrappers in
`bazel-genfiles/tensorflow/cc/ops/user_ops.{h,cc}`.
All generated wrappers for user ops are automatically
imported into [`tensorflow/cc/ops/standard_ops.h`][standard_ops-cc] with the
statement
```c++
#include "tensorflow/cc/ops/user_ops.h"
```
## Verify it works <a class="md-anchor" id="AUTOGENERATED-verify-it-works"></a>
A good way to verify that you've successfully implemented your Op is to write a
test for it. Create the file
`tensorflow/python/kernel_tests/zero_out_op_test.py` with the contents:
```python
import tensorflow as tf
class ZeroOutTest(tf.test.TestCase):
def testZeroOut(self):
with self.test_session():
result = tf.user_ops.zero_out([5, 4, 3, 2, 1])
self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0])
```
Then run your test:
```sh
$ bazel test tensorflow/python:zero_out_op_test
```
## Validation <a class="md-anchor" id="Validation"></a>
The example above assumed that the Op applied to a tensor of any shape. What
if it only applied to vectors? That means adding a check to the above OpKernel
implementation.
```c++
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
OP_REQUIRES(context, TensorShapeUtils::IsVector(input_tensor.shape()),
errors::InvalidArgument("ZeroOut expects a 1-D vector."));
// ...
}
```
This asserts that the input is a vector, and returns having set the
`InvalidArgument` status if it isn't. The
[`OP_REQUIRES` macro][validation-macros] takes three arguments:
* The `context`, which can either be an `OpKernelContext` or
`OpKernelConstruction` pointer (see
[`tensorflow/core/framework/op_kernel.h`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/op_kernel.h)),
for its `SetStatus()` method.
* The condition. For example, there are functions for validating the shape
of a tensor in
[`tensorflow/core/public/tensor_shape.h`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/public/tensor_shape.h)
* The error itself, which is represented by a `Status` object, see
[`tensorflow/core/public/status.h`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/public/status.h). A
`Status` has both a type (frequently `InvalidArgument`, but see the list of
types) and a message. Functions for constructing an error may be found in
[`tensorflow/core/lib/core/errors.h`][validation-macros].
Alternatively, if you want to test whether a `Status` object returned from some
function is an error, and if so return it, use
[`OP_REQUIRES_OK`][validation-macros]. Both of these macros return from the
function on error.
## Op registration <a class="md-anchor" id="AUTOGENERATED-op-registration"></a>
### Attrs <a class="md-anchor" id="Attrs"></a>
Ops can have attrs, whose values are set when the Op is added to a graph. These
are used to configure the Op, and their values can be accessed both within the
kernel implementation and in the types of inputs and outputs in the Op
registration. Prefer using an input instead of an attr when possible, since
inputs are more flexible. They can change every step, be set using a feed, etc.
Attrs are used for things that can't be done with inputs: any configuration
that affects the signature (number or type of inputs or outputs) or that
can't change from step-to-step.
You define an attr when you register the Op, by specifying its name and type
using the `Attr` method, which expects a spec of the form:
```
<name>: <attr-type-expr>
```
where `<name>` begins with a letter and can be composed of alphanumeric
characters and underscores, and `<attr-type-expr>` is a type expression of the
form [described below](#attr-types)
For example, if you'd like the `ZeroOut` Op to preserve a user-specified index,
instead of only the 0th element, you can register the Op like so:
<code class="lang-c++"><pre>
REGISTER\_OP("ZeroOut")
<b>.Attr("preserve\_index: int")</b>
.Input("to\_zero: int32")
.Output("zeroed: int32");
</pre></code>
Your kernel can then access this attr in its constructor via the `context`
parameter:
<code class="lang-c++"><pre>
class ZeroOutOp : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction\* context) : OpKernel(context) {<b>
// Get the index of the value to preserve
OP\_REQUIRES\_OK(context,
context->GetAttr("preserve\_index", &preserve\_index\_));
// Check that preserve\_index is positive
OP\_REQUIRES(context, preserve\_index_ >= 0,
errors::InvalidArgument("Need preserve\_index >= 0, got ",
preserve\_index_));
</b>}
void Compute(OpKernelContext\* context) override {
// ...
}
<b>private:
int preserve\_index\_;</b>
};
</pre></code>
which can then be used in the `Compute` method:
<code class="lang-c++"><pre>
void Compute(OpKernelContext\* context) override {
// ...
<br/> <b>// Check that preserve_index is in range
OP\_REQUIRES(context, preserve\_index_ < input.dimension(0),
errors::InvalidArgument("preserve\_index out of range"));<br/>
</b>// Set all the elements of the output tensor to 0
const int N = input.size();
for (int i = 0; i < N; i++) {
output\_flat(i) = 0;
}<br/>
<b>// Preserve the requested input value
output\_flat(preserve\_index\_) = input(preserve\_index\_);</b>
}
</pre></code>
> To preserve [backwards compatibility](#backwards-compatibility), you should
> specify a [default value](#default-values-constraints) when adding an attr to
> an existing op:
>
> <code class="lang-c++"><pre>
> REGISTER\_OP("ZeroOut")
> <b>.Attr("preserve\_index: int = 0")</b>
> .Input("to_zero: int32")
> .Output("zeroed: int32");
> </pre></code>
### Attr types <a class="md-anchor" id="AUTOGENERATED-attr-types"></a>
The following types are supported in an attr:
* `string`: Any sequence of bytes (not required to be UTF8).
* `int`: A signed integer.
* `float`: A floating point number.
* `bool`: True or false.
* `type`: One of the (non-ref) values of [`DataType`][DataTypeString].
* `shape`: A [`TensorShapeProto`][TensorShapeProto].
* `tensor`: A [`TensorProto`][TensorProto].
* `list(<type>)`: A list of `<type>`, where `<type>` is one of the above types.
Note that `list(list(<type>))` is invalid.
See also: [`op_def_builder.cc:FinalizeAttr`][FinalizeAttr] for a definitive list.
#### Default values & constraints <a class="md-anchor" id="AUTOGENERATED-default-values---constraints"></a>
Attrs may have default values, and some types of attrs can have constraints. To
define an attr with constraints, you can use the following `<attr-type-expr>`s:
* `{'<string1>', '<string2>'}`: The value must be a string that has either the
value `<string1>` or `<string2>`. The name of the type, `string`, is implied
when you use this syntax. This emulates an enum:
```c++
REGISTER_OP("EnumExample")
.Attr("e: {'apple', 'orange'}");
```
* `{<type1>, <type2>}`: The value is of type `type`, and must be one of
`<type1>` or `<type2>`, where `<type1>` and `<type2>` are supported
[tensor types](../../resources/dims_types.md#data-types). You don't specify
that the type of the attr is `type`. This is implied when you have a list of
types in `{...}`. For example, in this case the attr `t` is a type that must
be an `int32`, a `float`, or a `bool`:
```c++
REGISTER_OP("RestrictedTypeExample")
.Attr("t: {int32, float, bool}");
```
* There are shortcuts for common type constraints:
* `numbertype`: Type `type` restricted to the numeric (non-string and
non-bool) types.
* `realnumbertype`: Like `numbertype` without complex types.
* `quantizedtype`: Like `numbertype` but just the quantized number types.
The specific lists of types allowed by these are defined by the functions
(like `NumberTypes()`) in
[`tensorflow/core/framework/types.h`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/types.h).
In this example the attr `t` must be one of the numeric types:
```c++
REGISTER_OP("NumberType")
.Attr("t: numbertype");
```
For this op:
```python
tf.number_type(t=tf.int32) # Valid
tf.number_type(t=tf.bool) # Invalid
```
* `int >= <n>`: The value must be an int whose value is greater than or equal to
`<n>`, where `<n>` is a natural number.
For example, the following Op registration specifies that the attr `a` must
have a value that is at least `2`:
```c++
REGISTER_OP("MinIntExample")
.Attr("a: int >= 2");
```
* `list(<type>) >= <n>`: A list of type `<type>` whose length is greater than
or equal to `<n>`.
For example, the following Op registration specifies that the attr `a` is a
list of types (either `int32` or `float`), and that there must be at least 3
of them:
```c++
REGISTER_OP("TypeListExample")
.Attr("a: list({int32, float}) >= 3");
```
To set a default value for an attr (making it optional in the generated code),
add `= <default>` to the end, as in:
```c++
REGISTER_OP("AttrDefaultExample")
.Attr("i: int = 0");
```
The supported syntax of the default value is what would be used in the proto
representation of the resulting GraphDef definition.
Here are examples for how to specify a default for all types:
```c++
REGISTER_OP("AttrDefaultExampleForAllTypes")
.Attr("s: string = 'foo'")
.Attr("i: int = 0")
.Attr("f: float = 1.0")
.Attr("b: bool = true")
.Attr("ty: type = DT_INT32")
.Attr("sh: shape = { dim { size: 1 } dim { size: 2 } }")
.Attr("te: tensor = { dtype: DT_INT32 int_val: 5 }")
.Attr("l_empty: list(int) = []")
.Attr("l_int: list(int) = [2, 3, 5, 7]");
```
Note in particular that the values of type `type` use [the `DT_*` names
for the types](../../resources/dims_types.md#data-types).
### Polymorphism <a class="md-anchor" id="Polymorphism"></a>
#### Type Polymorphism <a class="md-anchor" id="type-polymorphism"></a>
For ops that can take different types as input or produce different output
types, you can specify [an attr](#attrs) in
[an input or output type](#inputs-outputs) in the Op registration. Typically
you would then register an `OpKernel` for each supported type.
For instance, if you'd like the `ZeroOut` Op to work on `float`s
in addition to `int32`s, your Op registration might look like:
<code class="lang-c++"><pre>
REGISTER\_OP("ZeroOut")
<b>.Attr("T: {float, int32}")</b>
.Input("to_zero: <b>T</b>")
.Output("zeroed: <b>T</b>");
</pre></code>
Your Op registration now specifies that the input's type must be `float`, or
`int32`, and that its output will be the same type, since both have type `T`.
> A note on naming:{#naming} Inputs, outputs, and attrs generally should be
> given snake_case names. The one exception is attrs that are used as the type
> of an input or in the type of an input. Those attrs can be inferred when the
> op is added to the graph and so don't appear in the op's function. For
> example, this last definition of ZeroOut will generate a Python function that
> looks like:
>
> ```python
> def zero_out(to_zero, name=None):
> """...
> Args:
> to_zero: A `Tensor`. Must be one of the following types:
> `float32`, `int32`.
> name: A name for the operation (optional).
>
> Returns:
> A `Tensor`. Has the same type as `to_zero`.
> """
> ```
>
> If `to_zero` is passed an `int32` tensor, then `T` is automatically set to
> `int32` (well, actually `DT_INT32`). Those inferred attrs are given
> Capitalized or CamelCase names.
>
> Compare this with an op that has a type attr that determines the output
> type:
>
> ```c++
> REGISTER_OP("StringToNumber")
> .Input("string_tensor: string")
> .Output("output: out_type")
> .Attr("out_type: {float, int32}");
> .Doc(R"doc(
> Converts each string in the input Tensor to the specified numeric type.
> )doc");
> ```
>
> In this case, the user has to specify the output type, as in the generated
> Python:
>
> ```python
> def string_to_number(string_tensor, out_type=None, name=None):
> """Converts each string in the input Tensor to the specified numeric type.
>
> Args:
> string_tensor: A `Tensor` of type `string`.
> out_type: An optional `tf.DType` from: `tf.float32, tf.int32`.
> Defaults to `tf.float32`.
> name: A name for the operation (optional).
>
> Returns:
> A `Tensor` of type `out_type`.
> """
> ```
<code class="lang-c++"><pre>
\#include "tensorflow/core/framework/op_kernel.h"<br/>
class ZeroOut<b>Int32</b>Op : public OpKernel {
// as before
};<br/>
class ZeroOut<b>Float</b>Op : public OpKernel {
public:
explicit ZeroOut<b>Float</b>Op(OpKernelConstruction\* context)
: OpKernel(context) {}<br/>
void Compute(OpKernelContext\* context) override {
// Grab the input tensor
const Tensor& input\_tensor = context->input(0);
auto input = input\_tensor.flat<<b>float</b>>();<br/>
// Create an output tensor
Tensor* output = NULL;
OP\_REQUIRES\_OK(context,
context->allocate\_output(0, input_tensor.shape(), &output));
auto output\_flat = output->template flat<<b>float</b>>();<br/>
// Set all the elements of the output tensor to 0
const int N = input.size();
for (int i = 0; i < N; i++) {
output\_flat(i) = 0;
}<br/>
// Preserve the first input value
if (N > 0) output\_flat(0) = input(0);
}
};<br/><b>
// Note that TypeConstraint<int32>("T") means that attr "T" (defined
// in the Op registration above) must be "int32" to use this template
// instantiation.</b>
REGISTER\_KERNEL\_BUILDER(
Name("ZeroOut")
.Device(DEVICE\_CPU)
<b>.TypeConstraint<int32>("T"),</b>
ZeroOutOp<b>Int32</b>);
<b>REGISTER\_KERNEL\_BUILDER(
Name("ZeroOut")
.Device(DEVICE\_CPU)
.TypeConstraint<float>("T"),
ZeroOutFloatOp);
</b></pre></code>
> To preserve [backwards compatibility](#backwards-compatibility), you should
> specify a [default value](#default-values-constraints) when adding an attr to
> an existing op:
>
> <code class="lang-c++"><pre>
> REGISTER\_OP("ZeroOut")
> <b>.Attr("T: {float, int32} = DT_INT32")</b>
> .Input("to_zero: T")
> .Output("zeroed: T")
> </pre></code>
Lets say you wanted to add more types, say `double`:
<code class="lang-c++"><pre>
REGISTER\_OP("ZeroOut")
<b>.Attr("T: {float, <b>double,</b> int32}")</b>
.Input("to_zero: <b>T</b>")
.Output("zeroed: <b>T</b>");
</pre></code>
Instead of writing another `OpKernel` with redundant code as above, often you
will be able to use a C++ template instead. You will still have one kernel
registration (`REGISTER\_KERNEL\_BUILDER` call) per overload.
<code class="lang-c++"><pre>
<b>template <typename T></b>
class ZeroOutOp : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction\* context) : OpKernel(context) {}<br/>
void Compute(OpKernelContext\* context) override {
// Grab the input tensor
const Tensor& input\_tensor = context->input(0);
auto input = input\_tensor.flat<b><T></b>();<br/>
// Create an output tensor
Tensor* output = NULL;
OP\_REQUIRES\_OK(context,
context->allocate\_output(0, input_tensor.shape(), &output));
auto output\_flat = output->template flat<b><T></b>();<br/>
// Set all the elements of the output tensor to 0
const int N = input.size();
for (int i = 0; i < N; i++) {
output\_flat(i) = 0;
}<br/>
// Preserve the first input value
if (N > 0) output\_flat(0) = input(0);
}
};<br/>
// Note that TypeConstraint<int32>("T") means that attr "T" (defined
// in the Op registration above) must be "int32" to use this template
// instantiation.</b>
REGISTER\_KERNEL\_BUILDER(
Name("ZeroOut")
.Device(DEVICE\_CPU)
.TypeConstraint<int32>("T"),
<b>ZeroOutOp<int32></b>);
REGISTER\_KERNEL\_BUILDER(
Name("ZeroOut")
.Device(DEVICE\_CPU)
.TypeConstraint<float>("T"),
<b>ZeroOutOp<float></b>);
<b>REGISTER\_KERNEL\_BUILDER(
Name("ZeroOut")
.Device(DEVICE\_CPU)
.TypeConstraint<double>("T"),
ZeroOutOp<double>);
</b></pre></code>
If you have more than a couple overloads, you can put the registration in a
macro.
```c++
#include "tensorflow/core/framework/op_kernel.h"
#define REGISTER_KERNEL(type) \
REGISTER_KERNEL_BUILDER( \
Name("ZeroOut").Device(DEVICE_CPU).TypeConstraint<type>("T"), \
ZeroOutOp<type>)
REGISTER_KERNEL(int32);
REGISTER_KERNEL(float);
REGISTER_KERNEL(double);
#undef REGISTER_KERNEL
```
Depending on the list of types you are registering the kernel for, you may be
able to use a macro provided by
[`tensorflow/core/framework/register_types.h`][register_types]:
```c++
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
REGISTER_OP("ZeroOut")
.Attr("T: realnumbertype")
.Input("to_zero: T")
.Output("zeroed: T");
template <typename T>
class ZeroOutOp : public OpKernel { ... };
#define REGISTER_KERNEL(type) \
REGISTER_KERNEL_BUILDER( \
Name("ZeroOut").Device(DEVICE_CPU).TypeConstraint<type>("T"), \
ZeroOutOp<type>)
TF_CALL_REAL_NUMBER_TYPES(REGISTER_KERNEL);
#undef REGISTER_KERNEL
```
#### List Inputs and Outputs <a class="md-anchor" id="list-input-output"></a>
In addition to being able to accept or produce different types, ops can consume
or produce a variable number of tensors.
In the next example, the attr `T` holds a *list* of types, and is used as the
type of both the input `in` and the output `out`. The input and output are
lists of tensors of that type (and the number and types of tensors in the output
are the same as the input, since both have type `T`).
```c++
REGISTER_OP("PolymorphicListExample")
.Attr("T: list(type)")
.Input("in: T")
.Output("out: T");
```
You can also place restrictions on what types can be specified in the list. In
this next case, the input is a list of `float` and `double` tensors. The Op
accepts, for example, input types `(float, double, float)` and in that case the
output type would also be `(float, double, float)`.
```c++
REGISTER_OP("ListTypeRestrictionExample")
.Attr("T: list({float, double})")
.Input("in: T")
.Output("out: T");
```
If you want all the tensors in a list to be of the same type, you might do
something like:
```c++
REGISTER_OP("IntListInputExample")
.Attr("N: int")
.Input("in: N * int32")
.Output("out: int32");
```
This accepts a list of `int32` tensors, and uses an `int` attr `N` to
specify the length of the list.
This can be made [type polymorphic](#type-polymorphism) as well. In the next
example, the input is a list of tensors (with length `"N"`) of the same (but
unspecified) type (`"T"`), and the output is a single tensor of matching type:
```c++
REGISTER_OP("SameListInputExample")
.Attr("N: int")
.Attr("T: type")
.Input("in: N * T")
.Output("out: T");
```
By default, tensor lists have a minimum length of 1. You can change that default
using
[a `">="` constraint on the corresponding attr](#default-values-constraints).
In this next example, the input is a list of at least 2 `int32` tensors:
```c++
REGISTER_OP("MinLengthIntListExample")
.Attr("N: int >= 2")
.Input("in: N * int32")
.Output("out: int32");
```
The same syntax works with `"list(type)"` attrs:
```c++
REGISTER_OP("MinimumLengthPolymorphicListExample")
.Attr("T: list(type) >= 3")
.Input("in: T")
.Output("out: T");
```
### Inputs and Outputs <a class="md-anchor" id="AUTOGENERATED-inputs-and-outputs"></a>
To summarize the above, an Op registration can have multiple inputs and outputs:
```c++
REGISTER_OP("MultipleInsAndOuts")
.Input("y: int32")
.Input("z: float")
.Output("a: string")
.Output("b: int32");
```
Each input or output spec is of the form:
```
<name>: <io-type-expr>
```
where `<name>` begins with a letter and can be composed of alphanumeric
characters and underscores. `<io-type-expr>` is one of the following type
expressions:
* `<type>`, where `<type>` is a supported input type (e.g. `float`, `int32`,
`string`). This specifies a single tensor of the given type.
See
[the list of supported Tensor types](../../resources/dims_types.md#data-types).
```c++
REGISTER_OP("BuiltInTypesExample")
.Input("integers: int32")
.Input("complex_numbers: scomplex64");
```
* `<attr-type>`, where `<attr-type>` is the name of an [Attr](#attrs) with type
`type` or `list(type)` (with a possible type restriction). This syntax allows
for [polymorphic ops](#Polymorphism).
```c++
REGISTER_OP("PolymorphicSingleInput")
.Attr("T: type")
.Input("in: T);
REGISTER_OP("RestrictedPolymorphicSingleInput")
.Attr("T: {int32, int64}")
.Input("in: T);
```
Referencing an attr of type `list(type)` allows you to accept a sequence of
tensors.
```c++
REGISTER_OP("ArbitraryTensorSequenceExample")
.Attr("T: list(type)")
.Input("in: T")
.Output("out: T");
REGISTER_OP("RestrictedTensorSequenceExample")
.Attr("T: list({int32, int64})")
.Input("in: T")
.Output("out: T");
```
Note that the number and types of tensors in the output `out` is the same as
in the input `in`, since both are of type `T`.
* For a sequence of tensors with the same type: `<number> * <type>`, where
`<number>` is the name of an [Attr](#attrs) with type `int`. The `<type>` can
either be
[a specific type like `int32` or `float`](../../resources/dims_types.md#data-types),
or the name of an attr with type `type`. As an example of the first, this
Op accepts a list of `int32` tensors:
```c++
REGISTER_OP("Int32SequenceExample")
.Attr("NumTensors: int")
.Input("in: NumTensors * int32")
```
Whereas this Op accepts a list of tensors of any type, as long as they are all
the same:
```c++
REGISTER_OP("SameTypeSequenceExample")
.Attr("NumTensors: int")
.Attr("T: type")
.Input("in: NumTensors * T")
```
* For a reference to a tensor: `Ref(<type>)`, where `<type>` is one of the
previous types.
> A note on naming: Any attr used in the type of an input will be inferred. By
> convention those inferred attrs use capital names (like `T` or `N`).
> Otherwise inputs, outputs, and attrs have names like function parameters
> (e.g. `num_outputs`). For more details, see the
> [earlier note on naming](#naming).
For more details, see
[`tensorflow/core/framework/op_def_builder.h`][op_def_builder].
### Backwards compatibility <a class="md-anchor" id="AUTOGENERATED-backwards-compatibility"></a>
In general, changes to specifications must be backwards-compatible: changing the
specification of an Op must not break prior serialized GraphDefs constructed
from older specfications.
There are several ways to preserve backwards-compatibility.
1. Any new attrs added to an operation must have default values defined, and
with that default value the Op must have the original behavior. To change an
operation from not polymorphic to polymorphic, you *must* give a default
value to the new type attr to preserve the original signature by default. For
example, if your operation was:
```c++
REGISTER_OP("MyGeneralUnaryOp")
.Input("in: float")
.Output("out: float");
```
you can make it polymorphic in a backwards-compatible way using:
```c++
REGISTER_OP("MyGeneralUnaryOp")
.Input("in: T")
.Output("out: T")
.Attr("T: numerictype = float");
```
1. You can safely make a constraint on an attr less restrictive. For example,
you can change from `{int32, int64}` to `{int32, int64, float}` or from
`{"apple", "orange"}` to `{"apple", "banana", "orange"}`.
1. Namespace any new Ops you create, by prefixing the Op names with something
unique to your project. This avoids having your Op colliding with any Ops
that might be included in future versions of Tensorflow.
1. Plan ahead! Try to anticipate future uses for the Op. Some signature changes
can't be done in a compatible way (for example, adding an input, or making a
single input into a list).
The full list of safe and unsafe changes can be found in
[tensorflow/core/framework/op_compatibility_test.cc](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/op_compatibility_test.cc).
If you cannot make your change to an operation backwards compatible, then create
a new operation with a new name with the new semantics.
## GPU Support <a class="md-anchor" id="mult-archs"></a>
You can implement different OpKernels and register one for CPU and another for
GPU, just like you can [register kernels for different types](#Polymorphism).
There are several examples of kernels with GPU support in
[`tensorflow/core/kernels/`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/kernels/).
Notice some kernels have a CPU version in a `.cc` file, a GPU version in a file
ending in `_gpu.cu.cc`, and some code shared in common in a `.h` file.
For example, the [`pad` op](../../api_docs/python/array_ops.md#pad) has
everything but the GPU kernel in [`tensorflow/core/kernels/pad_op.cc`][pad_op].
The GPU kernel is in
[`tensorflow/core/kernels/pad_op_gpu.cu.cc`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/kernels/pad_op_gpu.cu.cc),
and the shared code is a templated class defined in
[`tensorflow/core/kernels/pad_op.h`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/kernels/pad_op.h).
One thing to note, even when the GPU kernel version of `pad` is used, it still
needs its `"paddings"` input in CPU memory. To mark that inputs or outputs are
kept on the CPU, add a `HostMemory()` call to the kernel registration, e.g.:
```c++
#define REGISTER_GPU_KERNEL(T) \
REGISTER_KERNEL_BUILDER(Name("Pad") \
.Device(DEVICE_GPU) \
.TypeConstraint<T>("T") \
.HostMemory("paddings"), \
PadOp<GPUDevice, T>)
```
## Implement the gradient in Python <a class="md-anchor" id="AUTOGENERATED-implement-the-gradient-in-python"></a>
Given a graph of ops, TensorFlow uses automatic differentiation
(backpropagation) to add new ops representing gradients with respect to the
existing ops (see
[Gradient Computation](../../api_docs/python/train.md#gradient-computation)).
To make automatic differentiation work for new ops, you must register a gradient
function which computes gradients with respect to the ops' inputs given
gradients with respect to the ops' outputs.
Mathematically, if an op computes \\(y = f(x)\\) the registered gradient op
converts gradients \\(\partial / \partial y\\) with respect to \\(y\\) into
gradients \\(\partial / \partial x\\) with respect to \\(x\\) via the chain
rule:
$$\frac{\partial}{\partial x}
= \frac{\partial}{\partial y} \frac{\partial y}{\partial x}
= \frac{\partial}{\partial y} \frac{\partial f}{\partial x}.$$
In the case of `ZeroOut`, only one entry in the input affects the output, so the
gradient with respect to the input is a sparse "one hot" tensor. This is
expressed as follows:
```python
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import sparse_ops
@ops.RegisterGradient("ZeroOut")
def _zero_out_grad(op, grad):
"""The gradients for `zero_out`.
Args:
op: The `zero_out` `Operation` that we are differentiating, which we can use
to find the inputs and outputs of the original op.
grad: Gradient with respect to the output of the `zero_out` op.
Returns:
Gradients with respect to the input of `zero_out`.
"""
to_zero = op.inputs[0]
shape = array_ops.shape(to_zero)
index = array_ops.zeros_like(shape)
first_grad = array_ops.reshape(grad, [-1])[0]
to_zero_grad = sparse_ops.sparse_to_dense(index, shape, first_grad, 0)
return [to_zero_grad] # List of one Tensor, since we have one input
```
Details about registering gradient functions with
[`ops.RegisterGradient`](../../api_docs/python/framework.md#RegisterGradient):
* For an op with one output, the gradient function will take an
[`Operation`](../../api_docs/python/framework.md#Operation) `op` and a
[`Tensor`](../../api_docs/python/framework.md#Tensor) `grad` and build new ops
out of the tensors
[`op.inputs[i]`](../../api_docs/python/framework.md#Operation.inputs),
[`op.outputs[i]`](../../api_docs/python/framework.md#Operation.outputs), and `grad`. Information
about any attrs can be found via
[`op.get_attr`](../../api_docs/python/framework.md#Operation.get_attr).
* If the op has multiple outputs, the gradient function will take `op` and
`grads`, where `grads` is a list of gradients with respect to each output.
The result of the gradient function must be a list of `Tensor` objects
representing the gradients with respect to each input.
* If there is no well-defined gradient for some input, such as for integer
inputs used as indices, the corresponding returned gradient should be
`None`. For example, for an op taking a floating point tensor `x` and an
integer index `i`, the gradient function would `return [x_grad, None]`.
* If there is no meaningful gradient for the op at all, use
`ops.NoGradient("OpName")` to disable automatic differentiation.
Note that at the time the gradient function is called, only the data flow graph
of ops is available, not the tensor data itself. Thus, all computation must be
performed using other tensorflow ops, to be run at graph execution time.
## Implement a shape function in Python <a class="md-anchor" id="AUTOGENERATED-implement-a-shape-function-in-python"></a>
The TensorFlow Python API has a feature called "shape inference" that provides
information about the shapes of tensors without having to execute the
graph. Shape inference is supported by "shape functions" that are registered for
each op type, and perform two roles: asserting that the shapes of the inputs are
compatible, and specifying the shapes for the outputs. A shape function is a
Python function that takes an
[`Operation`](../../api_docs/python/framework.md#Operation) as input, and
returns a list of
[`TensorShape`](../../api_docs/python/framework.md#TensorShape) objects (one per
output of the op). To register a shape function, apply the
[`tf.RegisterShape` decorator](../../api_docs/python/framework.md#RegisterShape)
to a shape function. For example, the
[`ZeroOut` op defined above](#define_interface) would have a shape function like
the following:
```python
@tf.RegisterShape("ZeroOut"):
def _zero_out_shape(op):
"""Shape function for the ZeroOut op.
This is the unconstrained version of ZeroOut, which produces an output
with the same shape as its input.
"""
return [op.inputs[0].get_shape()]
```
A shape function can also constrain the shape of an input. For the version of
[`ZeroOut` with a vector shape constraint](#Validation), the shape function
would be as follows:
```python
@tf.RegisterShape("ZeroOut"):
def _zero_out_shape(op):
"""Shape function for the ZeroOut op.
This is the constrained version of ZeroOut, which requires the input to
have rank 1 (a vector).
"""
input_shape = op.inputs[0].get_shape().with_rank(1)
return [input_shape]
```
If your op is [polymorphic with multiple inputs](#Polymorphism), use the
properties of the operation to determine the number of shapes to check:
```
@tf.RegisterShape("IntListInputExample")
def _int_list_input_example_shape(op):
"""Shape function for the "IntListInputExample" op.
All inputs and the output are matrices of the same size.
"""
output_shape = tf.TensorShape(None)
for input in op.inputs:
output_shape = output_shape.merge_with(input.get_shape().with_rank(2))
return [output_shape]
```
Since shape inference is an optional feature, and the shapes of tensors may vary
dynamically, shape functions must be robust to incomplete shape information for
any of the inputs. The [`merge_with`](../../api_docs/python/framework.md)
method allows the caller to assert that two shapes are the same, even if either
or both of them do not have complete information. Shape functions are defined
for all of the
[standard Python ops](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/ops/),
and provide many different usage examples.
[core-array_ops]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/ops/array_ops.cc
[python-user_ops]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/user_ops/user_ops.py
[tf-kernels]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/kernels/
[user_ops]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/user_ops/
[pad_op]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/kernels/pad_op.cc
[standard_ops-py]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/ops/standard_ops.py
[standard_ops-cc]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/cc/ops/standard_ops.h
[python-BUILD]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/BUILD
[validation-macros]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/lib/core/errors.h
[op_def_builder]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/op_def_builder.h
[register_types]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/register_types.h
[FinalizeAttr]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/op_def_builder.cc#FinalizeAttr
[DataTypeString]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/types.cc#DataTypeString
[python-BUILD]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/python/BUILD
[types-proto]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/types.proto
[TensorShapeProto]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/tensor_shape.proto
[TensorProto]:https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/tensor.proto
| {
"content_hash": "6bb346c19640fa95ceef4668b2036bc3",
"timestamp": "",
"source": "github",
"line_count": 1098,
"max_line_length": 161,
"avg_line_length": 38.45992714025501,
"alnum_prop": 0.6943095976698478,
"repo_name": "arunhotra/tensorflow",
"id": "9dd2456e0b315ad1c78599378a2cedabbf8828c2",
"size": "42309",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tensorflow/g3doc/how_tos/adding_an_op/index.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "127104"
},
{
"name": "C++",
"bytes": "4899429"
},
{
"name": "CSS",
"bytes": "107"
},
{
"name": "HTML",
"bytes": "637241"
},
{
"name": "Java",
"bytes": "44388"
},
{
"name": "JavaScript",
"bytes": "5067"
},
{
"name": "Objective-C",
"bytes": "630"
},
{
"name": "Protocol Buffer",
"bytes": "45213"
},
{
"name": "Python",
"bytes": "2477787"
},
{
"name": "Shell",
"bytes": "1714"
},
{
"name": "TypeScript",
"bytes": "237446"
}
],
"symlink_target": ""
} |
package vrpsim.simulationmodel.initialbehaviour.simpleapi.impl.spiral;
import java.util.ArrayList;
import java.util.List;
import vrpsim.simulationmodel.initialbehaviour.simpleapi.api.model.CustomerAPI;
import vrpsim.simulationmodel.initialbehaviour.simpleapi.api.model.IJob;
import vrpsim.simulationmodel.initialbehaviour.simpleapi.api.model.LocationAPI;
public class Raster {
private int rows;
private int columns;
private LocationAPI bottomLeft;
private LocationAPI topRight;
private double height;
private double length;
private double cellHeight;
private double cellLength;
private LocationAPI[][] cells;
public Raster(int columns, int rows, LocationAPI bottomLeft, LocationAPI topRight) {
super();
this.rows = rows;
this.columns = columns;
this.bottomLeft = bottomLeft;
this.topRight = topRight;
this.height = topRight.getyCoord() - bottomLeft.getyCoord();
this.length = topRight.getxCoord() - bottomLeft.getxCoord();
this.cellHeight = this.height / (rows - 1);
this.cellLength = this.length / (columns - 1);
this.cells = new LocationAPI[columns][rows];
double x = bottomLeft.getxCoord();
double y = bottomLeft.getyCoord();
for (int i = 0; i < columns; i++) {
for (int j = 0; j < rows; j++) {
cells[i][j] = new LocationAPI(x, y);
y += cellHeight;
}
x += cellLength;
y = bottomLeft.getyCoord();
}
}
public List<CustomerAPI> getJobsInCell(int column, int row, List<CustomerAPI> jobs) {
List<CustomerAPI> res = new ArrayList<>();
LocationAPI cellLocation = cells[column][row];
for (CustomerAPI job : jobs) {
if (isJobInCell(job, cellLocation))
res.add(job);
}
return res;
}
public LocationAPI getCellLocation(IJob job) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
if (isJobInCell(job, cells[i][j]))
return cells[i][j];
}
}
return null;
}
public int getCellRow(IJob job) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
if (isJobInCell(job, cells[i][j]))
return j;
}
}
return -1;
}
public int getCellRow(LocationAPI location) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
if (isLocationInCell(location, cells[i][j]))
return j;
}
}
return -1;
}
public int getCellColumn(IJob job) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
if (isJobInCell(job, cells[i][j]))
return i;
}
}
return -1;
}
public int getCellColumn(LocationAPI location) {
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < cells[i].length; j++) {
if (isLocationInCell(location, cells[i][j]))
return j;
}
}
return -1;
}
private boolean isJobInCell(IJob job, LocationAPI cellLocation) {
double jobx = job.getLocation().getxCoord();
double joby = job.getLocation().getyCoord();
if ((jobx >= cellLocation.getxCoord()) && (joby >= cellLocation.getyCoord()) && (jobx < cellLocation.getxCoord() + cellLength)
&& (joby < cellLocation.getyCoord() + cellHeight))
return true;
else
return false;
}
private boolean isLocationInCell(LocationAPI location, LocationAPI cellLocation) {
double locx = location.getxCoord();
double locy = location.getyCoord();
if ((locx >= cellLocation.getxCoord()) && (locy >= cellLocation.getyCoord()) && (locx < cellLocation.getxCoord() + cellLength)
&& (locy < cellLocation.getyCoord() + cellHeight))
return true;
else
return false;
}
public int getRows() {
return rows;
}
public int getColumns() {
return columns;
}
public LocationAPI getBottomLeft() {
return bottomLeft;
}
public LocationAPI getTopRight() {
return topRight;
}
public double getHeight() {
return height;
}
public double getLength() {
return length;
}
public double getCellHeight() {
return cellHeight;
}
public double getCellLength() {
return cellLength;
}
public LocationAPI[][] getCells() {
return cells;
}
}
| {
"content_hash": "9fa3b356c80f71449d52dd020d213737",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 128,
"avg_line_length": 25.012422360248447,
"alnum_prop": 0.6647628507573876,
"repo_name": "MayerTh/RVRPSimulator",
"id": "5cfdd69f8324b0fe2b1aaa6b2e78a06c39074a2b",
"size": "4027",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vrpsim-simulationmodel-initialbehaviour-simpleapi/src/main/java/vrpsim/simulationmodel/initialbehaviour/simpleapi/impl/spiral/Raster.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "654148"
}
],
"symlink_target": ""
} |
using System;
namespace AspNetDeploy.SolutionParsers.VisualStudio
{
[Flags]
public enum VsProjectType
{
Undefined = 0,
Web = 1,
Console = 2,
Service = 4,
ClassLibrary = 8,
Deployment = 16,
Database = 32,
Test = 64,
WindowsApplication = 128,
NetCore = 256
}
} | {
"content_hash": "350214794176d11dd50253875faf4a9b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 18.736842105263158,
"alnum_prop": 0.5308988764044944,
"repo_name": "adoconnection/AspNetDeploy",
"id": "d796757da04d9df784bf1ca1c221ac035b2e1088",
"size": "358",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AspNetDeploy.SolutionParsers.VisualStudio/VsProjectType.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "109"
},
{
"name": "C#",
"bytes": "646083"
},
{
"name": "CSS",
"bytes": "2736"
},
{
"name": "HTML",
"bytes": "200487"
},
{
"name": "JavaScript",
"bytes": "860756"
},
{
"name": "TSQL",
"bytes": "48051"
}
],
"symlink_target": ""
} |
package server
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"regexp"
"strconv"
"testing"
"time"
"github.com/go-sql-driver/mysql"
"github.com/ngaut/log"
. "github.com/pingcap/check"
"github.com/pingcap/tidb/executor"
tmysql "github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/util/printer"
)
func TestT(t *testing.T) {
CustomVerboseFlag = true
TestingT(t)
}
var regression = true
var dsn = "root@tcp(localhost:4001)/test?strict=true"
func runTests(c *C, dsn string, tests ...func(dbt *DBTest)) {
db, err := sql.Open("mysql", dsn)
c.Assert(err, IsNil, Commentf("Error connecting"))
defer db.Close()
db.Exec("DROP TABLE IF EXISTS test")
dbt := &DBTest{c, db}
for _, test := range tests {
test(dbt)
dbt.db.Exec("DROP TABLE IF EXISTS test")
}
}
func runTestsOnNewDB(c *C, dbName string, tests ...func(dbt *DBTest)) {
db, err := sql.Open("mysql", "root@tcp(localhost:4001)/?strict=true")
c.Assert(err, IsNil, Commentf("Error connecting"))
defer db.Close()
dropDB := fmt.Sprintf("DROP DATABASE IF EXISTS %s;", dbName)
createDB := fmt.Sprintf("CREATE DATABASE %s;", dbName)
useDB := fmt.Sprintf("USE %s;", dbName)
_, err = db.Exec(dropDB)
c.Assert(err, IsNil, Commentf("Error drop database %s", dbName))
_, err = db.Exec(createDB)
c.Assert(err, IsNil, Commentf("Error create database %s", dbName))
_, err = db.Exec(useDB)
c.Assert(err, IsNil, Commentf("Error use database %s", dbName))
dbt := &DBTest{c, db}
for _, test := range tests {
test(dbt)
dbt.db.Exec("DROP TABLE IF EXISTS test")
}
_, err = db.Exec(dropDB)
c.Assert(err, IsNil, Commentf("Error drop database %s", dbName))
}
type DBTest struct {
*C
db *sql.DB
}
func (dbt *DBTest) fail(method, query string, err error) {
if len(query) > 300 {
query = "[query too large to print]"
}
dbt.Fatalf("Error on %s %s: %s", method, query, err.Error())
}
func (dbt *DBTest) mustExec(query string, args ...interface{}) (res sql.Result) {
res, err := dbt.db.Exec(query, args...)
dbt.Assert(err, IsNil, Commentf("Exec %s", query))
return res
}
func (dbt *DBTest) mustQuery(query string, args ...interface{}) (rows *sql.Rows) {
rows, err := dbt.db.Query(query, args...)
dbt.Assert(err, IsNil, Commentf("Query %s", query))
return rows
}
func (dbt *DBTest) mustQueryRows(query string, args ...interface{}) {
rows := dbt.mustQuery(query, args...)
dbt.Assert(rows.Next(), IsTrue)
rows.Close()
}
func runTestRegression(c *C, dbName string) {
runTestsOnNewDB(c, dbName, func(dbt *DBTest) {
// Create Table
dbt.mustExec("CREATE TABLE test (val TINYINT)")
// Test for unexpected data
var out bool
rows := dbt.mustQuery("SELECT * FROM test")
dbt.Assert(rows.Next(), IsFalse, Commentf("unexpected data in empty table"))
// Create Data
res := dbt.mustExec("INSERT INTO test VALUES (1)")
// res := dbt.mustExec("INSERT INTO test VALUES (?)", 1)
count, err := res.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Check(count, Equals, int64(1))
id, err := res.LastInsertId()
dbt.Assert(err, IsNil)
dbt.Check(id, Equals, int64(0))
// Read
rows = dbt.mustQuery("SELECT val FROM test")
if rows.Next() {
rows.Scan(&out)
dbt.Check(out, IsTrue)
dbt.Check(rows.Next(), IsFalse, Commentf("unexpected data"))
} else {
dbt.Error("no data")
}
rows.Close()
// Update
res = dbt.mustExec("UPDATE test SET val = 0 WHERE val = ?", 1)
count, err = res.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Check(count, Equals, int64(1))
// Check Update
rows = dbt.mustQuery("SELECT val FROM test")
if rows.Next() {
rows.Scan(&out)
dbt.Check(out, IsFalse)
dbt.Check(rows.Next(), IsFalse, Commentf("unexpected data"))
} else {
dbt.Error("no data")
}
rows.Close()
// Delete
res = dbt.mustExec("DELETE FROM test WHERE val = 0")
// res = dbt.mustExec("DELETE FROM test WHERE val = ?", 0)
count, err = res.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Check(count, Equals, int64(1))
// Check for unexpected rows
res = dbt.mustExec("DELETE FROM test")
count, err = res.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Check(count, Equals, int64(0))
dbt.mustQueryRows("SELECT 1")
b := []byte{}
if err := dbt.db.QueryRow("SELECT ?", b).Scan(&b); err != nil {
dbt.Fatal(err)
}
if b == nil {
dbt.Error("nil echo from non-nil input")
}
})
}
func runTestPrepareResultFieldType(t *C) {
var param int64 = 83
runTests(t, dsn, func(dbt *DBTest) {
stmt, err := dbt.db.Prepare(`SELECT ?`)
if err != nil {
dbt.Fatal(err)
}
defer stmt.Close()
row := stmt.QueryRow(param)
var result int64
err = row.Scan(&result)
if err != nil {
dbt.Fatal(err)
}
switch {
case result != param:
dbt.Fatal("Unexpected result value")
}
})
}
func runTestSpecialType(t *C) {
runTestsOnNewDB(t, "SpecialType", func(dbt *DBTest) {
dbt.mustExec("create table test (a decimal(10, 5), b datetime, c time)")
dbt.mustExec("insert test values (1.4, '2012-12-21 12:12:12', '4:23:34')")
rows := dbt.mustQuery("select * from test where a > ?", 0)
t.Assert(rows.Next(), IsTrue)
var outA float64
var outB, outC string
err := rows.Scan(&outA, &outB, &outC)
t.Assert(err, IsNil)
t.Assert(outA, Equals, 1.4)
t.Assert(outB, Equals, "2012-12-21 12:12:12")
t.Assert(outC, Equals, "04:23:34")
})
}
func runTestPreparedString(t *C) {
runTestsOnNewDB(t, "PreparedString", func(dbt *DBTest) {
dbt.mustExec("create table test (a char(10), b char(10))")
dbt.mustExec("insert test values (?, ?)", "abcdeabcde", "abcde")
rows := dbt.mustQuery("select * from test where 1 = ?", 1)
t.Assert(rows.Next(), IsTrue)
var outA, outB string
err := rows.Scan(&outA, &outB)
t.Assert(err, IsNil)
t.Assert(outA, Equals, "abcdeabcde")
t.Assert(outB, Equals, "abcde")
})
}
func runTestLoadData(c *C) {
// create a file and write data.
path := "/tmp/load_data_test.csv"
fp, err := os.Create(path)
c.Assert(err, IsNil)
c.Assert(fp, NotNil)
defer func() {
err = fp.Close()
c.Assert(err, IsNil)
err = os.Remove(path)
c.Assert(err, IsNil)
variable.GoSQLDriverTest = false
}()
variable.GoSQLDriverTest = true
_, err = fp.WriteString(`
xxx row1_col1 - row1_col2 1abc
xxx row2_col1 - row2_col2
xxxy row3_col1 - row3_col2
xxx row4_col1 - 900
xxx row5_col1 - row5_col3`)
c.Assert(err, IsNil)
// support ClientLocalFiles capability
runTests(c, dsn+"&allowAllFiles=true", func(dbt *DBTest) {
dbt.mustExec("create table test (a varchar(255), b varchar(255) default 'default value', c int not null auto_increment, primary key(c))")
rs, err := dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test")
dbt.Assert(err, IsNil)
lastID, err := rs.LastInsertId()
dbt.Assert(err, IsNil)
dbt.Assert(lastID, Equals, int64(1))
affectedRows, err := rs.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Assert(affectedRows, Equals, int64(5))
var (
a string
b string
bb sql.NullString
cc int
)
rows := dbt.mustQuery("select * from test")
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
err = rows.Scan(&a, &bb, &cc)
dbt.Check(err, IsNil)
dbt.Check(a, DeepEquals, "")
dbt.Check(bb.String, DeepEquals, "")
dbt.Check(cc, DeepEquals, 1)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "xxx row2_col1")
dbt.Check(b, DeepEquals, "- row2_col2")
dbt.Check(cc, DeepEquals, 2)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "xxxy row3_col1")
dbt.Check(b, DeepEquals, "- row3_col2")
dbt.Check(cc, DeepEquals, 3)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "xxx row4_col1")
dbt.Check(b, DeepEquals, "- ")
dbt.Check(cc, DeepEquals, 4)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "xxx row5_col1")
dbt.Check(b, DeepEquals, "- ")
dbt.Check(cc, DeepEquals, 5)
dbt.Check(rows.Next(), IsFalse, Commentf("unexpected data"))
rows.Close()
// specify faileds and lines
dbt.mustExec("delete from test")
rs, err = dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test fields terminated by '\t- ' lines starting by 'xxx ' terminated by '\n'")
dbt.Assert(err, IsNil)
lastID, err = rs.LastInsertId()
dbt.Assert(err, IsNil)
dbt.Assert(lastID, Equals, int64(6))
affectedRows, err = rs.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Assert(affectedRows, Equals, int64(4))
rows = dbt.mustQuery("select * from test")
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "row1_col1")
dbt.Check(b, DeepEquals, "row1_col2\t1abc")
dbt.Check(cc, DeepEquals, 6)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "row2_col1")
dbt.Check(b, DeepEquals, "row2_col2\t")
dbt.Check(cc, DeepEquals, 7)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "row4_col1")
dbt.Check(b, DeepEquals, "\t\t900")
dbt.Check(cc, DeepEquals, 8)
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
rows.Scan(&a, &b, &cc)
dbt.Check(a, DeepEquals, "row5_col1")
dbt.Check(b, DeepEquals, "\trow5_col3")
dbt.Check(cc, DeepEquals, 9)
dbt.Check(rows.Next(), IsFalse, Commentf("unexpected data"))
// infile size more than a packet size(16K)
dbt.mustExec("delete from test")
_, err = fp.WriteString("\n")
dbt.Assert(err, IsNil)
for i := 6; i <= 800; i++ {
_, err = fp.WriteString(fmt.Sprintf("xxx row%d_col1 - row%d_col2\n", i, i))
dbt.Assert(err, IsNil)
}
rs, err = dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test fields terminated by '\t- ' lines starting by 'xxx ' terminated by '\n'")
dbt.Assert(err, IsNil)
lastID, err = rs.LastInsertId()
dbt.Assert(err, IsNil)
dbt.Assert(lastID, Equals, int64(10))
affectedRows, err = rs.RowsAffected()
dbt.Assert(err, IsNil)
dbt.Assert(affectedRows, Equals, int64(799))
rows = dbt.mustQuery("select * from test")
dbt.Check(rows.Next(), IsTrue, Commentf("unexpected data"))
// don't support lines terminated is ""
rs, err = dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test lines terminated by ''")
dbt.Assert(err, NotNil)
// infile doesn't exist
rs, err = dbt.db.Exec("load data local infile '/tmp/nonexistence.csv' into table test")
dbt.Assert(err, NotNil)
})
// unsupport ClientLocalFiles capability
defaultCapability ^= tmysql.ClientLocalFiles
runTests(c, dsn+"&allowAllFiles=true", func(dbt *DBTest) {
dbt.mustExec("create table test (a varchar(255), b varchar(255) default 'default value', c int not null auto_increment, primary key(c))")
_, err = dbt.db.Exec("load data local infile '/tmp/load_data_test.csv' into table test")
dbt.Assert(err, NotNil)
checkErrorCode(c, err, tmysql.ErrNotAllowedCommand)
})
defaultCapability |= tmysql.ClientLocalFiles
}
func runTestConcurrentUpdate(c *C) {
runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec("create table test (a int, b int)")
dbt.mustExec("insert test values (1, 1)")
txn1, err := dbt.db.Begin()
c.Assert(err, IsNil)
txn2, err := dbt.db.Begin()
c.Assert(err, IsNil)
_, err = txn2.Exec("update test set a = a + 1 where b = 1")
c.Assert(err, IsNil)
err = txn2.Commit()
c.Assert(err, IsNil)
_, err = txn1.Exec("update test set a = a + 1 where b = 1")
c.Assert(err, IsNil)
err = txn1.Commit()
c.Assert(err, IsNil)
})
}
func runTestErrorCode(c *C) {
runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec("create table test (c int PRIMARY KEY);")
dbt.mustExec("insert into test values (1);")
txn1, err := dbt.db.Begin()
c.Assert(err, IsNil)
_, err = txn1.Exec("insert into test values(1)")
c.Assert(err, IsNil)
err = txn1.Commit()
checkErrorCode(c, err, tmysql.ErrDupEntry)
// Schema errors
txn2, err := dbt.db.Begin()
c.Assert(err, IsNil)
_, err = txn2.Exec("use db_not_exists;")
checkErrorCode(c, err, tmysql.ErrBadDB)
_, err = txn2.Exec("select * from tbl_not_exists;")
checkErrorCode(c, err, tmysql.ErrNoSuchTable)
_, err = txn2.Exec("create database test;")
checkErrorCode(c, err, tmysql.ErrDBCreateExists)
_, err = txn2.Exec("create database aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;")
checkErrorCode(c, err, tmysql.ErrTooLongIdent)
_, err = txn2.Exec("create table test (c int);")
checkErrorCode(c, err, tmysql.ErrTableExists)
_, err = txn2.Exec("drop table unknown_table;")
checkErrorCode(c, err, tmysql.ErrBadTable)
_, err = txn2.Exec("drop database unknown_db;")
checkErrorCode(c, err, tmysql.ErrDBDropExists)
_, err = txn2.Exec("create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (a int);")
checkErrorCode(c, err, tmysql.ErrTooLongIdent)
_, err = txn2.Exec("create table long_column_table (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);")
checkErrorCode(c, err, tmysql.ErrTooLongIdent)
_, err = txn2.Exec("alter table test add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int;")
checkErrorCode(c, err, tmysql.ErrTooLongIdent)
// Optimizer errors
_, err = txn2.Exec("select *, * from test;")
checkErrorCode(c, err, tmysql.ErrParse)
_, err = txn2.Exec("select row(1, 2) > 1;")
checkErrorCode(c, err, tmysql.ErrOperandColumns)
_, err = txn2.Exec("select * from test order by row(c, c);")
checkErrorCode(c, err, tmysql.ErrOperandColumns)
// Variable errors
_, err = txn2.Exec("select @@unknown_sys_var;")
checkErrorCode(c, err, tmysql.ErrUnknownSystemVariable)
_, err = txn2.Exec("set @@unknown_sys_var='1';")
checkErrorCode(c, err, tmysql.ErrUnknownSystemVariable)
// Expression errors
_, err = txn2.Exec("select greatest(2);")
checkErrorCode(c, err, tmysql.ErrWrongParamcountToNativeFct)
})
}
func checkErrorCode(c *C, e error, code uint16) {
me, ok := e.(*mysql.MySQLError)
c.Assert(ok, IsTrue, Commentf("err: %v", e))
c.Assert(me.Number, Equals, code)
}
func runTestAuth(c *C) {
runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec(`CREATE USER 'test'@'%' IDENTIFIED BY '123';`)
dbt.mustExec(`FLUSH PRIVILEGES;`)
})
newDsn := "test:123@tcp(localhost:4001)/test?strict=true"
runTests(c, newDsn, func(dbt *DBTest) {
dbt.mustExec(`USE mysql;`)
})
db, err := sql.Open("mysql", "test:456@tcp(localhost:4001)/test?strict=true")
_, err = db.Query("USE mysql;")
c.Assert(err, NotNil, Commentf("Wrong password should be failed"))
db.Close()
// Test login use IP that not exists in mysql.user.
runTests(c, dsn, func(dbt *DBTest) {
dbt.mustExec(`CREATE USER 'xxx'@'localhost' IDENTIFIED BY 'yyy';`)
dbt.mustExec(`FLUSH PRIVILEGES;`)
})
newDsn = "xxx:yyy@tcp(127.0.0.1:4001)/test?strict=true"
runTests(c, newDsn, func(dbt *DBTest) {
dbt.mustExec(`USE mysql;`)
})
}
func runTestIssues(c *C) {
// For issue #263
unExistsSchemaDsn := "root@tcp(localhost:4001)/unexists_schema?strict=true"
db, err := sql.Open("mysql", unExistsSchemaDsn)
c.Assert(db, NotNil)
c.Assert(err, IsNil)
// Open may just validate its arguments without creating a connection to the database. To verify that the data source name is valid, call Ping.
err = db.Ping()
c.Assert(err, NotNil, Commentf("Connecting to an unexists schema should be error"))
db.Close()
}
func runTestResultFieldTableIsNull(c *C) {
runTestsOnNewDB(c, "ResultFieldTableIsNull", func(dbt *DBTest) {
dbt.mustExec("drop table if exists test;")
dbt.mustExec("create table test (c int);")
dbt.mustExec("explain select * from test;")
})
}
func runTestStatusAPI(c *C) {
resp, err := http.Get("http://127.0.0.1:10090/status")
c.Assert(err, IsNil)
defer resp.Body.Close()
decoder := json.NewDecoder(resp.Body)
var data status
err = decoder.Decode(&data)
c.Assert(err, IsNil)
c.Assert(data.Version, Equals, tmysql.ServerVersion)
c.Assert(data.GitHash, Equals, printer.TiDBGitHash)
}
func runTestMultiStatements(c *C) {
runTestsOnNewDB(c, "MultiStatements", func(dbt *DBTest) {
// Create Table
dbt.mustExec("CREATE TABLE `test` (`id` int(11) NOT NULL, `value` int(11) NOT NULL) ")
// Create Data
res := dbt.mustExec("INSERT INTO test VALUES (1, 1)")
count, err := res.RowsAffected()
c.Assert(err, IsNil, Commentf("res.RowsAffected() returned error"))
c.Assert(count, Equals, int64(1))
// Update
res = dbt.mustExec("UPDATE test SET value = 3 WHERE id = 1; UPDATE test SET value = 4 WHERE id = 1; UPDATE test SET value = 5 WHERE id = 1;")
count, err = res.RowsAffected()
c.Assert(err, IsNil, Commentf("res.RowsAffected() returned error"))
c.Assert(count, Equals, int64(1))
// Read
var out int
rows := dbt.mustQuery("SELECT value FROM test WHERE id=1;")
if rows.Next() {
rows.Scan(&out)
c.Assert(out, Equals, 5)
if rows.Next() {
dbt.Error("unexpected data")
}
} else {
dbt.Error("no data")
}
})
}
func runTestStmtCount(t *C) {
runTests(t, dsn, func(dbt *DBTest) {
originStmtCnt := getStmtCnt(string(getMetrics(t)))
dbt.mustExec("create table test (a int)")
dbt.mustExec("insert into test values(1)")
dbt.mustExec("insert into test values(2)")
dbt.mustExec("insert into test values(3)")
dbt.mustExec("insert into test values(4)")
dbt.mustExec("insert into test values(5)")
dbt.mustExec("delete from test where a = 3")
dbt.mustExec("update test set a = 2 where a = 1")
dbt.mustExec("select * from test")
dbt.mustExec("select 2")
dbt.mustExec("prepare stmt1 from 'update test set a = 1 where a = 2'")
dbt.mustExec("execute stmt1")
dbt.mustExec("prepare stmt2 from 'select * from test'")
dbt.mustExec("execute stmt2")
currentStmtCnt := getStmtCnt(string(getMetrics(t)))
t.Assert(currentStmtCnt[executor.CreateTable], Equals, originStmtCnt[executor.CreateTable]+1)
t.Assert(currentStmtCnt[executor.Insert], Equals, originStmtCnt[executor.Insert]+5)
deleteLabel := "DeleteTableFull"
t.Assert(currentStmtCnt[deleteLabel], Equals, originStmtCnt[deleteLabel]+1)
updateLabel := "UpdateTableFull"
t.Assert(currentStmtCnt[updateLabel], Equals, originStmtCnt[updateLabel]+2)
selectLabel := "SelectTableFull"
t.Assert(currentStmtCnt[selectLabel], Equals, originStmtCnt[selectLabel]+2)
})
}
func getMetrics(t *C) []byte {
resp, err := http.Get("http://127.0.0.1:10090/metrics")
t.Assert(err, IsNil)
content, err := ioutil.ReadAll(resp.Body)
t.Assert(err, IsNil)
resp.Body.Close()
return content
}
func getStmtCnt(content string) (stmtCnt map[string]int) {
stmtCnt = make(map[string]int)
r, _ := regexp.Compile("tidb_executor_statement_node_total{type=\"([A-Z|a-z|-]+)\"} (\\d+)")
matchResult := r.FindAllStringSubmatch(content, -1)
for _, v := range matchResult {
cnt, _ := strconv.Atoi(v[2])
stmtCnt[v[1]] = cnt
}
return stmtCnt
}
const retryTime = 100
func waitUntilServerOnline(statusAddr string) {
// connect server
retry := 0
for ; retry < retryTime; retry++ {
time.Sleep(time.Millisecond * 10)
db, err := sql.Open("mysql", dsn)
if err == nil {
db.Close()
break
}
}
if retry == retryTime {
log.Fatalf("Failed to connect db for %d retries in every 10 ms", retryTime)
}
// connect http status
statusURL := fmt.Sprintf("http://127.0.0.1%s/status", statusAddr)
for retry = 0; retry < retryTime; retry++ {
resp, err := http.Get(statusURL)
if err == nil {
ioutil.ReadAll(resp.Body)
resp.Body.Close()
break
}
time.Sleep(time.Millisecond * 10)
}
if retry == retryTime {
log.Fatalf("Failed to connect http status for %d retries in every 10 ms", retryTime)
}
}
| {
"content_hash": "961ab855ac56a3e1787798791f225224",
"timestamp": "",
"source": "github",
"line_count": 629,
"max_line_length": 163,
"avg_line_length": 31.481717011128776,
"alnum_prop": 0.6752853247146753,
"repo_name": "simon-xia/tidb",
"id": "050fec8120cb53c4abb01dbe8c863aae1c8db9bb",
"size": "20317",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "server/server_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "4475969"
},
{
"name": "Makefile",
"bytes": "4739"
},
{
"name": "Shell",
"bytes": "3322"
},
{
"name": "Yacc",
"bytes": "142695"
}
],
"symlink_target": ""
} |
var controller = require('../../controller/postController');
module.exports = function (app) {
app.delete('/admin/post/:id', function (req, res) {
controller.delete(req, res);
});
app.put('/admin/post/:id', function (req, res) {
controller.edit(req, res);
});
app.post('/admin/post', function (req, res) {
controller.create(req, res);
});
app.get('/admin/post', function(req, res){
controller.findPostAdmin(req, res);
});
};
| {
"content_hash": "1d44b079fb81a561f6812d9566d86cd9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 60,
"avg_line_length": 30.625,
"alnum_prop": 0.5816326530612245,
"repo_name": "leonardoviveiros/blogcts",
"id": "582a97f110d18b6e89db703cd75ab9507a86958c",
"size": "490",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/routes/protected/postProtectedRoutes.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "31826"
}
],
"symlink_target": ""
} |
/*
Include declarations.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <locale.h>
#include "wand/MagickWand.h"
#include "magick/colorspace-private.h"
#include "magick/resource_.h"
#include "magick/string-private.h"
#include "validate.h"
/*
Define declarations.
*/
#define CIEEpsilon (216.0/24389.0)
#define CIEK (24389.0/27.0)
#define D65X 0.950456
#define D65Y 1.0
#define D65Z 1.088754
#define ReferenceEpsilon (1.0e-0)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e C o l o r s p a c e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateColorspaces() validates the ImageMagick colorspaces and returns the
% number of validation tests that passed and failed.
%
% The format of the ValidateColorspaces method is:
%
% size_t ValidateColorspaces(ImageInfo *image_info,size_t *fail,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static inline void ConvertRGBToXYZ(const double red,const double green,
const double blue,double *X,double *Y,double *Z)
{
double
b,
g,
r;
r=QuantumScale*DecodePixelGamma(red);
g=QuantumScale*DecodePixelGamma(green);
b=QuantumScale*DecodePixelGamma(blue);
*X=0.41239558896741421610*r+0.35758343076371481710*g+0.18049264738170157350*b;
*Y=0.21258623078559555160*r+0.71517030370341084990*g+0.07220049864333622685*b;
*Z=0.01929721549174694484*r+0.11918386458084853180*g+0.95049712513157976600*b;
}
static inline void ConvertXYZToLab(const double X,const double Y,const double Z,
double *L,double *a,double *b)
{
double
x,
y,
z;
if ((X/D65X) > CIEEpsilon)
x=pow(X/D65X,1.0/3.0);
else
x=(CIEK*X/D65X+16.0)/116.0;
if ((Y/D65Y) > CIEEpsilon)
y=pow(Y/D65Y,1.0/3.0);
else
y=(CIEK*Y/D65Y+16.0)/116.0;
if ((Z/D65Z) > CIEEpsilon)
z=pow(Z/D65Z,1.0/3.0);
else
z=(CIEK*Z/D65Z+16.0)/116.0;
*L=((116.0*y)-16.0)/100.0;
*a=(500.0*(x-y))/255.0+0.5;
*b=(200.0*(y-z))/255.0+0.5;
}
static void ConvertRGBToLab(const double red,const double green,
const double blue,double *L,double *a,double *b)
{
double
X,
Y,
Z;
ConvertRGBToXYZ(red,green,blue,&X,&Y,&Z);
ConvertXYZToLab(X,Y,Z,L,a,b);
}
static inline void ConvertLabToXYZ(const double L,const double a,const double b,
double *X,double *Y,double *Z)
{
double
x,
y,
z;
y=(L+16.0)/116.0;
x=y+a/500.0;
z=y-b/200.0;
if ((x*x*x) > CIEEpsilon)
x=(x*x*x);
else
x=(116.0*x-16.0)/CIEK;
if ((y*y*y) > CIEEpsilon)
y=(y*y*y);
else
y=L/CIEK;
if ((z*z*z) > CIEEpsilon)
z=(z*z*z);
else
z=(116.0*z-16.0)/CIEK;
*X=D65X*x;
*Y=D65Y*y;
*Z=D65Z*z;
}
static inline void ConvertXYZToRGB(const double x,const double y,const double z,
Quantum *red,Quantum *green,Quantum *blue)
{
double
b,
g,
r;
r=3.2406*x-1.5372*y-0.4986*z;
g=(-0.9689*x+1.8758*y+0.0415*z);
b=0.0557*x-0.2040*y+1.0570*z;
*red=ClampToQuantum(EncodePixelGamma(QuantumRange*r));
*green=ClampToQuantum(EncodePixelGamma(QuantumRange*g));
*blue=ClampToQuantum(EncodePixelGamma(QuantumRange*b));
}
static inline void ConvertLabToRGB(const double L,const double a,
const double b,Quantum *red,Quantum *green,Quantum *blue)
{
double
X,
Y,
Z;
ConvertLabToXYZ(L*100.0,255.0*(a-0.5),255.0*(b-0.5),&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
static void ConvertRGBToYPbPr(const double red,const double green,
const double blue,double *Y,double *Pb,double *Pr)
{
*Y=QuantumScale*(0.298839*red+0.586811*green+0.114350*blue);
*Pb=QuantumScale*((-0.1687367)*red-0.331264*green+0.5*blue)+0.5;
*Pr=QuantumScale*(0.5*red-0.418688*green-0.081312*blue)+0.5;
}
static void ConvertRGBToYCbCr(const double red,const double green,
const double blue,double *Y,double *Cb,double *Cr)
{
ConvertRGBToYPbPr(red,green,blue,Y,Cb,Cr);
}
static void ConvertYPbPrToRGB(const double Y,const double Pb,const double Pr,
Quantum *red,Quantum *green,Quantum *blue)
{
*red=ClampToQuantum(QuantumRange*(0.99999999999914679361*Y-
1.2188941887145875e-06*(Pb-0.5)+1.4019995886561440468*(Pr-0.5)));
*green=ClampToQuantum(QuantumRange*(0.99999975910502514331*Y-
0.34413567816504303521*(Pb-0.5)-0.71413649331646789076*(Pr-0.5)));
*blue=ClampToQuantum(QuantumRange*(1.00000124040004623180*Y+
1.77200006607230409200*(Pb-0.5)+2.1453384174593273e-06*(Pr-0.5)));
}
static void ConvertYCbCrToRGB(const double Y,const double Cb,
const double Cr,Quantum *red,Quantum *green,Quantum *blue)
{
ConvertYPbPrToRGB(Y,Cb,Cr,red,green,blue);
}
static inline void ConvertLCHabToXYZ(const double luma,const double chroma,
const double hue,double *X,double *Y,double *Z)
{
ConvertLabToXYZ(luma,chroma*cos(hue*MagickPI/180.0),chroma*
sin(hue*MagickPI/180.0),X,Y,Z);
}
static inline void ConvertXYZToLCHab(const double X,const double Y,
const double Z,double *luma,double *chroma,double *hue)
{
double
a,
b;
ConvertXYZToLab(X,Y,Z,luma,&a,&b);
*chroma=hypot(255.0*(a-0.5),255.0*(b-0.5));
*hue=180.0*atan2(255.0*(b-0.5),255.0*(a-0.5))/MagickPI;
*chroma=(*chroma)/255.0+0.5;
*hue=(*hue)/255.0+0.5;
if (*hue < 0.0)
*hue+=1.0;
}
static inline void ConvertLMSToXYZ(const double L,const double M,const double S,
double *X,double *Y,double *Z)
{
*X=1.096123820835514*L-0.278869000218287*M+0.182745179382773*S;
*Y=0.454369041975359*L+0.473533154307412*M+0.072097803717229*S;
*Z=(-0.009627608738429)*L-0.005698031216113*M+1.015325639954543*S;
}
static inline void ConvertLMSToRGB(const double L,const double M,
const double S,Quantum *red,Quantum *green,Quantum *blue)
{
double
X,
Y,
Z;
ConvertLMSToXYZ(L,M,S,&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
static inline void ConvertXYZToLMS(const double x,const double y,
const double z,double *L,double *M,double *S)
{
*L=0.7328*x+0.4296*y-0.1624*z;
*M=(-0.7036*x+1.6975*y+0.0061*z);
*S=0.0030*x+0.0136*y+0.9834*z;
}
static void ConvertRGBToLMS(const double red,const double green,
const double blue,double *L,double *M,double *S)
{
double
X,
Y,
Z;
ConvertRGBToXYZ(red,green,blue,&X,&Y,&Z);
ConvertXYZToLMS(X,Y,Z,L,M,S);
}
static inline double PerceptibleReciprocal(const double x)
{
double
sign;
/*
Return 1/x where x is perceptible (not unlimited or infinitesimal).
*/
sign=x < 0.0 ? -1.0 : 1.0;
if ((sign*x) >= MagickEpsilon)
return(1.0/x);
return(sign/MagickEpsilon);
}
static inline void ConvertXYZToLuv(const double X,const double Y,const double Z,
double *L,double *u,double *v)
{
double
alpha;
if ((Y/D65Y) > CIEEpsilon)
*L=(double) (116.0*pow(Y/D65Y,1.0/3.0)-16.0);
else
*L=CIEK*(Y/D65Y);
alpha=PerceptibleReciprocal(X+15.0*Y+3.0*Z);
*u=13.0*(*L)*((4.0*alpha*X)-(4.0*D65X/(D65X+15.0*D65Y+3.0*D65Z)));
*v=13.0*(*L)*((9.0*alpha*Y)-(9.0*D65Y/(D65X+15.0*D65Y+3.0*D65Z)));
*L/=100.0;
*u=(*u+134.0)/354.0;
*v=(*v+140.0)/262.0;
}
static void ConvertRGBToLuv(const double red,const double green,
const double blue,double *L,double *u,double *v)
{
double
X,
Y,
Z;
ConvertRGBToXYZ(red,green,blue,&X,&Y,&Z);
ConvertXYZToLuv(X,Y,Z,L,u,v);
}
static inline void ConvertLuvToXYZ(const double L,const double u,const double v,
double *X,double *Y,double *Z)
{
if (L > (CIEK*CIEEpsilon))
*Y=(double) pow((L+16.0)/116.0,3.0);
else
*Y=L/CIEK;
*X=((*Y*((39.0*L/(v+13.0*L*(9.0*D65Y/(D65X+15.0*D65Y+3.0*D65Z))))-5.0))+
5.0*(*Y))/((((52.0f*L/(u+13.0*L*(4.0*D65X/(D65X+15.0*D65Y+3.0*D65Z))))-1.0)/
3.0)-(-1.0/3.0));
*Z=(*X*(((52.0f*L/(u+13.0*L*(4.0*D65X/(D65X+15.0*D65Y+3.0*D65Z))))-1.0)/3.0))-
5.0*(*Y);
}
static inline void ConvertLuvToRGB(const double L,const double u,
const double v,Quantum *red,Quantum *green,Quantum *blue)
{
double
X,
Y,
Z;
ConvertLuvToXYZ(100.0*L,354.0*u-134.0,262.0*v-140.0,&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
static void ConvertRGBToYDbDr(const double red,const double green,
const double blue,double *Y,double *Db,double *Dr)
{
*Y=QuantumScale*(0.298839*red+0.586811*green+0.114350*blue);
*Db=QuantumScale*(-0.450*red-0.883*green+1.333*blue)+0.5;
*Dr=QuantumScale*(-1.333*red+1.116*green+0.217*blue)+0.5;
}
static void ConvertYDbDrToRGB(const double Y,const double Db,const double Dr,
Quantum *red,Quantum *green,Quantum *blue)
{
*red=ClampToQuantum(QuantumRange*(Y+9.2303716147657e-05*(Db-0.5)-
0.52591263066186533*(Dr-0.5)));
*green=ClampToQuantum(QuantumRange*(Y-0.12913289889050927*(Db-0.5)+
0.26789932820759876*(Dr-0.5)));
*blue=ClampToQuantum(QuantumRange*(Y+0.66467905997895482*(Db-0.5)-
7.9202543533108e-05*(Dr-0.5)));
}
static void ConvertRGBToYIQ(const double red,const double green,
const double blue,double *Y,double *I,double *Q)
{
*Y=QuantumScale*(0.298839*red+0.586811*green+0.114350*blue);
*I=QuantumScale*(0.595716*red-0.274453*green-0.321263*blue)+0.5;
*Q=QuantumScale*(0.211456*red-0.522591*green+0.311135*blue)+0.5;
}
static void ConvertYIQToRGB(const double Y,const double I,const double Q,
Quantum *red,Quantum *green,Quantum *blue)
{
*red=ClampToQuantum(QuantumRange*(Y+0.9562957197589482261*(I-0.5)+
0.6210244164652610754*(Q-0.5)));
*green=ClampToQuantum(QuantumRange*(Y-0.2721220993185104464*(I-0.5)-
0.6473805968256950427*(Q-0.5)));
*blue=ClampToQuantum(QuantumRange*(Y-1.1069890167364901945*(I-0.5)+
1.7046149983646481374*(Q-0.5)));
}
static void ConvertRGBToYUV(const double red,const double green,
const double blue,double *Y,double *U,double *V)
{
*Y=QuantumScale*(0.298839*red+0.586811*green+0.114350*blue);
*U=QuantumScale*((-0.147)*red-0.289*green+0.436*blue)+0.5;
*V=QuantumScale*(0.615*red-0.515*green-0.100*blue)+0.5;
}
static void ConvertYUVToRGB(const double Y,const double U,const double V,
Quantum *red,Quantum *green,Quantum *blue)
{
*red=ClampToQuantum(QuantumRange*(Y-3.945707070708279e-05*(U-0.5)+
1.1398279671717170825*(V-0.5)));
*green=ClampToQuantum(QuantumRange*(Y-0.3946101641414141437*(U-0.5)-
0.5805003156565656797*(V-0.5)));
*blue=ClampToQuantum(QuantumRange*(Y+2.0319996843434342537*(U-0.5)-
4.813762626262513e-04*(V-0.5)));
}
static MagickBooleanType ValidateHSIToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," HSIToRGB");
ConvertHSIToRGB(111.244375/360.0,0.295985,0.658734,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToHSI()
{
double
h,
i,
s;
(void) FormatLocaleFile(stdout," RGBToHSI");
ConvertRGBToHSI(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&h,&s,&i);
if ((fabs(h-111.244374/360.0) >= ReferenceEpsilon) ||
(fabs(s-0.295985) >= ReferenceEpsilon) ||
(fabs(i-0.658734) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateHSLToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," HSLToRGB");
ConvertHSLToRGB(110.200859/360.0,0.882623,0.715163,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToHSL()
{
double
h,
l,
s;
(void) FormatLocaleFile(stdout," RGBToHSL");
ConvertRGBToHSL(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&h,&s,&l);
if ((fabs(h-110.200859/360.0) >= ReferenceEpsilon) ||
(fabs(s-0.882623) >= ReferenceEpsilon) ||
(fabs(l-0.715163) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateHSVToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," HSVToRGB");
ConvertHSVToRGB(110.200859/360.0,0.520200,0.966567,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToHSV()
{
double
h,
s,
v;
(void) FormatLocaleFile(stdout," RGBToHSV");
ConvertRGBToHSV(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&h,&s,&v);
if ((fabs(h-110.200859/360.0) >= ReferenceEpsilon) ||
(fabs(s-0.520200) >= ReferenceEpsilon) ||
(fabs(v-0.966567) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToJPEGYCbCr()
{
double
Cb,
Cr,
Y;
(void) FormatLocaleFile(stdout," RGBToJPEGYCbCr");
ConvertRGBToYCbCr(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&Y,&Cb,&Cr);
if ((fabs(Y-0.783460) >= ReferenceEpsilon) ||
(fabs(Cb-0.319581) >= ReferenceEpsilon) ||
(fabs(Cr-0.330539) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateJPEGYCbCrToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," JPEGYCbCrToRGB");
ConvertYCbCrToRGB(0.783460,0.319581,0.330539,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateLabToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," LabToRGB");
ConvertLabToRGB(88.456154/100.0,-54.671483/255+0.5,51.662818/255.0+0.5,
&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToLab()
{
double
a,
b,
L;
(void) FormatLocaleFile(stdout," RGBToLab");
ConvertRGBToLab(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&L,&a,&b);
if ((fabs(L-(88.456154/100.0)) >= ReferenceEpsilon) ||
(fabs(a-(-54.671483/255.0+0.5)) >= ReferenceEpsilon) ||
(fabs(b-(51.662818/255.0+0.5)) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateLchToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," LchToRGB");
ConvertLCHabToRGB(88.456154/100.0,75.219797/255.0+0.5,136.620717/255.0+0.5,
&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToLch()
{
double
c,
h,
L;
(void) FormatLocaleFile(stdout," RGBToLch");
ConvertRGBToLCHab(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&L,&c,&h);
if ((fabs(L-88.456154/100.0) >= ReferenceEpsilon) ||
(fabs(c-(75.219797/255.0+0.5)) >= ReferenceEpsilon) ||
(fabs(h-(136.620717/255.0+0.5)) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToLMS()
{
double
L,
M,
S;
(void) FormatLocaleFile(stdout," RGBToLMS");
ConvertRGBToLMS(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&L,&M,&S);
if ((fabs(L-0.611749) >= ReferenceEpsilon) ||
(fabs(M-0.910088) >= ReferenceEpsilon) ||
(fabs(S-0.294880) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateLMSToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," LMSToRGB");
ConvertLMSToRGB(0.611749,0.910088,0.294880,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToLuv()
{
double
L,
u,
v;
(void) FormatLocaleFile(stdout," RGBToLuv");
ConvertRGBToLuv(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&L,&u,&v);
if ((fabs(L-88.456154/262.0) >= ReferenceEpsilon) ||
(fabs(u-(-51.330414+134.0)/354.0) >= ReferenceEpsilon) ||
(fabs(v-(76.405526+140.0)/262.0) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateLuvToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," LuvToRGB");
ConvertLuvToRGB(88.456154/100.0,(-51.330414+134.0)/354.0,
(76.405526+140.0)/262.0,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToXYZ()
{
double
x,
y,
z;
(void) FormatLocaleFile(stdout," RGBToXYZ");
ConvertRGBToXYZ(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&x,&y,&z);
if ((fabs(x-0.470646) >= ReferenceEpsilon) ||
(fabs(y-0.730178) >= ReferenceEpsilon) ||
(fabs(z-0.288324) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateXYZToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," XYZToRGB");
ConvertXYZToRGB(0.470646,0.730178,0.288324,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateYDbDrToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," YDbDrToRGB");
ConvertYDbDrToRGB(0.783460,-0.480932+0.5,0.451670+0.5,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToYDbDr()
{
double
Db,
Dr,
Y;
(void) FormatLocaleFile(stdout," RGBToYDbDr");
ConvertRGBToYDbDr(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&Y,&Db,&Dr);
if ((fabs(Y-0.783460) >= ReferenceEpsilon) ||
(fabs(Db-(-0.480932)) >= ReferenceEpsilon) ||
(fabs(Dr-0.451670) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToYIQ()
{
double
i,
q,
y;
(void) FormatLocaleFile(stdout," RGBToYIQ");
ConvertRGBToYIQ(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&y,&i,&q);
if ((fabs(y-0.783460) >= ReferenceEpsilon) ||
(fabs(i-(-0.089078)) >= ReferenceEpsilon) ||
(fabs(q-(-0.245399)) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateYIQToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," YIQToRGB");
ConvertYIQToRGB(0.783460,-0.089078+0.5,-0.245399+0.5,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToYPbPr()
{
double
Pb,
Pr,
Y;
(void) FormatLocaleFile(stdout," RGBToYPbPr");
ConvertRGBToYPbPr(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&Y,&Pb,&Pr);
if ((fabs(Y-0.783460) >= ReferenceEpsilon) ||
(fabs(Pb-(-0.180419)) >= ReferenceEpsilon) ||
(fabs(Pr-(-0.169461)) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateYPbPrToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," YPbPrToRGB");
ConvertYPbPrToRGB(0.783460,-0.180419+0.5,-0.169461+0.5,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateRGBToYUV()
{
double
U,
V,
Y;
(void) FormatLocaleFile(stdout," RGBToYUV");
ConvertRGBToYUV(0.545877*QuantumRange,0.966567*QuantumRange,
0.463759*QuantumRange,&Y,&U,&V);
if ((fabs(Y-0.783460) >= ReferenceEpsilon) ||
(fabs(U-(-0.157383)) >= ReferenceEpsilon) ||
(fabs(V-(-0.208443)) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static MagickBooleanType ValidateYUVToRGB()
{
Quantum
b,
g,
r;
(void) FormatLocaleFile(stdout," YUVToRGB");
ConvertYUVToRGB(0.783460,-0.157383+0.5,-0.208443+0.5,&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
(fabs(b-0.463759*QuantumRange) >= ReferenceEpsilon))
return(MagickFalse);
return(MagickTrue);
}
static size_t ValidateColorspaces(ImageInfo *image_info,size_t *fail,
ExceptionInfo *exception)
{
MagickBooleanType
status;
size_t
test;
/*
Reference: https://code.google.com/p/chroma.
Illuminant = D65
Observer = 2° (1931)
XYZ 0.470645, 0.730177, 0.288323
sRGB 0.545877, 0.966567, 0.463759
CAT02 LMS 0.611749, 0.910088, 0.294880
Y'DbDr 0.783460, -0.480932, 0.451670
Y'IQ 0.783460, -0.089078, -0.245399
Y'PbPr 0.783460, -0.180419, -0.169461
Y'UV 0.783460, -0.157383, -0.208443
JPEG-Y'CbCr 0.783460, 0.319581, 0.330539
L*u*v* 88.456154, -51.330414, 76.405526
L*a*b* 88.456154, -54.671483, 51.662818
L*C*H* 88.456154, 75.219797, 136.620717
HSV 110.200859, 0.520200, 0.966567
HSL 110.200859, 0.882623, 0.715163
HSI 111.244375, 0.295985, 0.658734
Y'CbCr 187.577791, 87.586330, 90.040886
*/
(void) FormatLocaleFile(stdout,"validate colorspaces:\n");
for (test=0; test < 26; test++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: ",(double) test);
switch (test)
{
case 0: status=ValidateHSIToRGB(); break;
case 1: status=ValidateRGBToHSI(); break;
case 2: status=ValidateHSLToRGB(); break;
case 3: status=ValidateRGBToHSL(); break;
case 4: status=ValidateHSVToRGB(); break;
case 5: status=ValidateRGBToHSV(); break;
case 6: status=ValidateJPEGYCbCrToRGB(); break;
case 7: status=ValidateRGBToJPEGYCbCr(); break;
case 8: status=ValidateLabToRGB(); break;
case 9: status=ValidateRGBToLab(); break;
case 10: status=ValidateLchToRGB(); break;
case 11: status=ValidateRGBToLch(); break;
case 12: status=ValidateLMSToRGB(); break;
case 13: status=ValidateRGBToLMS(); break;
case 14: status=ValidateLuvToRGB(); break;
case 15: status=ValidateRGBToLuv(); break;
case 16: status=ValidateXYZToRGB(); break;
case 17: status=ValidateRGBToXYZ(); break;
case 18: status=ValidateYDbDrToRGB(); break;
case 19: status=ValidateRGBToYDbDr(); break;
case 20: status=ValidateYIQToRGB(); break;
case 21: status=ValidateRGBToYIQ(); break;
case 22: status=ValidateYPbPrToRGB(); break;
case 23: status=ValidateRGBToYPbPr(); break;
case 24: status=ValidateYUVToRGB(); break;
case 25: status=ValidateRGBToYUV(); break;
default: status=MagickFalse;
}
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e C o m p a r e C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateCompareCommand() validates the ImageMagick compare command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateCompareCommand method is:
%
% size_t ValidateCompareCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateCompareCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate compare command line program:\n");
for (i=0; compare_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
compare_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
compare_options[i],reference_filename,reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=CompareImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e C o m p o s i t e C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateCompositeCommand() validates the ImageMagick composite command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateCompositeCommand method is:
%
% size_t ValidateCompositeCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateCompositeCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate composite command line program:\n");
for (i=0; composite_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
composite_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,composite_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=CompositeImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e C o n v e r t C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateConvertCommand() validates the ImageMagick convert command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateConvertCommand method is:
%
% size_t ValidateConvertCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateConvertCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate convert command line program:\n");
for (i=0; convert_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
convert_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,convert_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=ConvertImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e I d e n t i f y C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateIdentifyCommand() validates the ImageMagick identify command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateIdentifyCommand method is:
%
% size_t ValidateIdentifyCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateIdentifyCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
(void) output_filename;
test=0;
(void) FormatLocaleFile(stdout,"validate identify command line program:\n");
for (i=0; identify_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
identify_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s",
identify_options[i],reference_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=IdentifyImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e I m a g e F o r m a t s I n M e m o r y %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateImageFormatsInMemory() validates the ImageMagick image formats in
% memory and returns the number of validation tests that passed and failed.
%
% The format of the ValidateImageFormatsInMemory method is:
%
% size_t ValidateImageFormatsInMemory(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
/*
Enable this to count remaining $TMPDIR/magick-* files. Note that the count
includes any files left over from other runs.
*/
#undef MagickCountTempFiles
static size_t ValidateImageFormatsInMemory(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
#ifdef MagickCountTempFiles
path[MaxTextExtent],
SystemCommand[MaxTextExtent],
#endif
size[MaxTextExtent];
const MagickInfo
*magick_info;
double
distortion,
fuzz;
Image
*difference_image,
*ping_image,
*reference_image,
*reconstruct_image;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
length;
unsigned char
*blob;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate image formats in memory:\n");
#ifdef MagickCountTempFiles
(void) GetPathTemplate(path);
/* Remove file template except for the leading "/path/to/magick-" */
path[strlen(path)-17]='\0';
(void) FormatLocaleFile(stdout," tmp path is '%s*'\n",path);
#endif
for (i=0; reference_formats[i].magick != (char *) NULL; i++)
{
magick_info=GetMagickInfo(reference_formats[i].magick,exception);
if ((magick_info == (const MagickInfo *) NULL) ||
(magick_info->decoder == (DecodeImageHandler *) NULL) ||
(magick_info->encoder == (EncodeImageHandler *) NULL))
continue;
for (j=0; reference_types[j].type != UndefinedType; j++)
{
/*
Generate reference image.
*/
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s/%s/%s/%.20g-bits",
(double) (test++),reference_formats[i].magick,CommandOptionToMnemonic(
MagickCompressOptions,reference_formats[i].compression),
CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
(double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
(void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
(double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
(void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
status=SetImageType(reference_image,reference_types[j].type);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
status=SetImageDepth(reference_image,reference_types[j].depth);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image);
InheritException(exception,&reference_image->exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Ping reference image.
*/
(void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
ping_image=PingImage(image_info,exception);
if (ping_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
ping_image=DestroyImage(ping_image);
/*
Read reference image.
*/
(void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
(void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
(void) CopyMagickString(image_info->magick,reference_formats[i].magick,
MaxTextExtent);
reference_image->depth=reference_types[j].depth;
reference_image->compression=reference_formats[i].compression;
length=8192;
blob=ImageToBlob(image_info,reference_image,&length,exception);
if (blob == (unsigned char *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
/*
Ping reference blob.
*/
ping_image=PingBlob(image_info,blob,length,exception);
if (ping_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
blob=(unsigned char *) RelinquishMagickMemory(blob);
continue;
}
ping_image=DestroyImage(ping_image);
/*
Read reconstruct image.
*/
(void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=BlobToImage(image_info,blob,length,exception);
blob=(unsigned char *) RelinquishMagickMemory(blob);
if (reconstruct_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
/*
Compare reference to reconstruct image.
*/
fuzz=0.003; /* grayscale */
if (reference_formats[i].fuzz != 0.0)
fuzz=reference_formats[i].fuzz;
difference_image=CompareImageChannels(reference_image,reconstruct_image,
CompositeChannels,RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((QuantumScale*distortion) > fuzz)
{
(void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
QuantumScale*distortion);
(*fail)++;
continue;
}
#ifdef MagickCountTempFiles
(void) FormatLocaleFile(stdout,"... pass, ");
(void) fflush(stdout);
SystemCommand[0]='\0';
(void) strncat(SystemCommand,"echo `ls ",9);
(void) strncat(SystemCommand,path,MaxTextExtent-31);
(void) strncat(SystemCommand,"* | wc -w` tmp files.",20);
(void) system(SystemCommand);
(void) fflush(stdout);
#else
(void) FormatLocaleFile(stdout,"... pass\n");
#endif
}
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e I m a g e F o r m a t s O n D i s k %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateImageFormatsOnDisk() validates the ImageMagick image formats on disk
% and returns the number of validation tests that passed and failed.
%
% The format of the ValidateImageFormatsOnDisk method is:
%
% size_t ValidateImageFormatsOnDisk(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateImageFormatsOnDisk(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
size[MaxTextExtent];
const MagickInfo
*magick_info;
double
distortion,
fuzz;
Image
*difference_image,
*reference_image,
*reconstruct_image;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate image formats on disk:\n");
for (i=0; reference_formats[i].magick != (char *) NULL; i++)
{
magick_info=GetMagickInfo(reference_formats[i].magick,exception);
if ((magick_info == (const MagickInfo *) NULL) ||
(magick_info->decoder == (DecodeImageHandler *) NULL) ||
(magick_info->encoder == (EncodeImageHandler *) NULL))
continue;
for (j=0; reference_types[j].type != UndefinedType; j++)
{
/*
Generate reference image.
*/
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s/%s/%s/%.20g-bits",
(double) (test++),reference_formats[i].magick,CommandOptionToMnemonic(
MagickCompressOptions,reference_formats[i].compression),
CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
(double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
(void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
(double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
(void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
status=SetImageType(reference_image,reference_types[j].type);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
status=SetImageDepth(reference_image,reference_types[j].depth);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image);
InheritException(exception,&reference_image->exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Read reference image.
*/
(void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
/*
Write reference image.
*/
(void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image->depth=reference_types[j].depth;
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
/*
Read reconstruct image.
*/
(void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=ReadImage(image_info,exception);
if (reconstruct_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
/*
Compare reference to reconstruct image.
*/
fuzz=0.003; /* grayscale */
if (reference_formats[i].fuzz != 0.0)
fuzz=reference_formats[i].fuzz;
difference_image=CompareImageChannels(reference_image,reconstruct_image,
CompositeChannels,RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((QuantumScale*distortion) > fuzz)
{
(void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
QuantumScale*distortion);
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e I m p o r t E x p o r t P i x e l s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateImportExportPixels() validates the pixel import and export methods.
% It returns the number of validation tests that passed and failed.
%
% The format of the ValidateImportExportPixels method is:
%
% size_t ValidateImportExportPixels(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateImportExportPixels(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
double
distortion;
Image
*difference_image,
*reference_image,
*reconstruct_image;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
length;
unsigned char
*pixels;
size_t
test;
(void) output_filename;
test=0;
(void) FormatLocaleFile(stdout,
"validate the import and export of image pixels:\n");
for (i=0; reference_map[i] != (char *) NULL; i++)
{
for (j=0; reference_storage[j].type != UndefinedPixel; j++)
{
/*
Generate reference image.
*/
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s/%s",(double) (test++),
reference_map[i],CommandOptionToMnemonic(MagickStorageOptions,
reference_storage[j].type));
(void) CopyMagickString(image_info->filename,reference_filename,
MaxTextExtent);
reference_image=ReadImage(image_info,exception);
if (reference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
if (LocaleNCompare(reference_map[i],"cmy",3) == 0)
(void) TransformImageColorspace(reference_image,CMYKColorspace);
length=strlen(reference_map[i])*reference_image->columns*
reference_image->rows*reference_storage[j].quantum;
pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
(void) ResetMagickMemory(pixels,0,length*sizeof(*pixels));
status=ExportImagePixels(reference_image,0,0,reference_image->columns,
reference_image->rows,reference_map[i],reference_storage[j].type,pixels,
exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
continue;
}
(void) SetImageBackgroundColor(reference_image);
status=ImportImagePixels(reference_image,0,0,reference_image->columns,
reference_image->rows,reference_map[i],reference_storage[j].type,
pixels);
InheritException(exception,&reference_image->exception);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
continue;
}
/*
Read reconstruct image.
*/
reconstruct_image=AcquireImage(image_info);
(void) SetImageExtent(reconstruct_image,reference_image->columns,
reference_image->rows);
(void) SetImageColorspace(reconstruct_image,reference_image->colorspace);
(void) SetImageBackgroundColor(reconstruct_image);
status=ImportImagePixels(reconstruct_image,0,0,reconstruct_image->columns,
reconstruct_image->rows,reference_map[i],reference_storage[j].type,
pixels);
InheritException(exception,&reconstruct_image->exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
/*
Compare reference to reconstruct image.
*/
difference_image=CompareImageChannels(reference_image,reconstruct_image,
CompositeChannels,RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
if (difference_image == (Image *) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
difference_image=DestroyImage(difference_image);
if ((QuantumScale*distortion) > 0.0)
{
(void) FormatLocaleFile(stdout,"... fail (with distortion %g).\n",
QuantumScale*distortion);
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e M o n t a g e C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateMontageCommand() validates the ImageMagick montage command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateMontageCommand method is:
%
% size_t ValidateMontageCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateMontageCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate montage command line program:\n");
for (i=0; montage_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
montage_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
reference_filename,montage_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=MontageImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% V a l i d a t e S t r e a m C o m m a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ValidateStreamCommand() validates the ImageMagick stream command line
% program and returns the number of validation tests that passed and failed.
%
% The format of the ValidateStreamCommand method is:
%
% size_t ValidateStreamCommand(ImageInfo *image_info,
% const char *reference_filename,const char *output_filename,
% size_t *fail,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o reference_filename: the reference image filename.
%
% o output_filename: the output image filename.
%
% o fail: return the number of validation tests that pass.
%
% o exception: return any errors or warnings in this structure.
%
*/
static size_t ValidateStreamCommand(ImageInfo *image_info,
const char *reference_filename,const char *output_filename,size_t *fail,
ExceptionInfo *exception)
{
char
**arguments,
command[MaxTextExtent];
int
number_arguments;
MagickBooleanType
status;
register ssize_t
i,
j;
size_t
test;
test=0;
(void) FormatLocaleFile(stdout,"validate stream command line program:\n");
for (i=0; stream_options[i] != (char *) NULL; i++)
{
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
stream_options[i]);
(void) FormatLocaleString(command,MaxTextExtent,"%s %s %s",
stream_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
status=StreamImageCommand(image_info,number_arguments,arguments,
(char **) NULL,exception);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
if (status != MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
(*fail)++;
continue;
}
(void) FormatLocaleFile(stdout,"... pass.\n");
}
(void) FormatLocaleFile(stdout,
" summary: %.20g subtests; %.20g passed; %.20g failed.\n",(double) test,
(double) (test-(*fail)),(double) *fail);
return(test);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M a i n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
static MagickBooleanType ValidateUsage(void)
{
const char
**p;
static const char
*miscellaneous[]=
{
"-debug events display copious debugging information",
"-help print program options",
"-log format format of debugging information",
"-validate type validation type",
"-version print version information",
(char *) NULL
},
*settings[]=
{
"-regard-warnings pay attention to warning messages",
"-verbose print detailed information about the image",
(char *) NULL
};
(void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
(void) printf("Copyright: %s\n\n",GetMagickCopyright());
(void) printf("Features: %s\n",GetMagickFeatures());
(void) printf("Usage: %s [options ...] reference-file\n",GetClientName());
(void) printf("\nValidate Settings:\n");
for (p=settings; *p != (char *) NULL; p++)
(void) printf(" %s\n",*p);
(void) printf("\nMiscellaneous Options:\n");
for (p=miscellaneous; *p != (char *) NULL; p++)
(void) printf(" %s\n",*p);
return(MagickTrue);
}
int main(int argc,char **argv)
{
#define DestroyValidate() \
{ \
image_info=DestroyImageInfo(image_info); \
exception=DestroyExceptionInfo(exception); \
}
#define ThrowValidateException(asperity,tag,option) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
option); \
CatchException(exception); \
DestroyValidate(); \
return(MagickFalse); \
}
char
output_filename[MaxTextExtent],
reference_filename[MaxTextExtent],
*option;
double
elapsed_time,
user_time;
ExceptionInfo
*exception;
Image
*reference_image;
ImageInfo
*image_info;
MagickBooleanType
regard_warnings,
status;
MagickSizeType
memory_resource,
map_resource;
register ssize_t
i;
TimerInfo
*timer;
size_t
fail,
iterations,
tests;
ValidateType
type;
/*
Validate the ImageMagick image processing suite.
*/
MagickCoreGenesis(*argv,MagickTrue);
(void) setlocale(LC_ALL,"");
(void) setlocale(LC_NUMERIC,"C");
iterations=1;
status=MagickFalse;
type=AllValidate;
regard_warnings=MagickFalse;
(void) regard_warnings;
exception=AcquireExceptionInfo();
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->filename,ReferenceFilename,MaxTextExtent);
for (i=1; i < (ssize_t) argc; i++)
{
option=argv[i];
if (IsCommandOption(option) == MagickFalse)
{
(void) CopyMagickString(image_info->filename,option,MaxTextExtent);
continue;
}
switch (*(option+1))
{
case 'b':
{
if (LocaleCompare("bench",option+1) == 0)
{
iterations=StringToUnsignedLong(argv[++i]);
break;
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
case 'd':
{
if (LocaleCompare("debug",option+1) == 0)
{
(void) SetLogEventMask(argv[++i]);
break;
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
case 'h':
{
if (LocaleCompare("help",option+1) == 0)
{
(void) ValidateUsage();
return(0);
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
case 'l':
{
if (LocaleCompare("log",option+1) == 0)
{
if (*option != '+')
(void) SetLogFormat(argv[i+1]);
break;
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
case 'r':
{
if (LocaleCompare("regard-warnings",option+1) == 0)
{
regard_warnings=MagickTrue;
break;
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
case 'v':
{
if (LocaleCompare("validate",option+1) == 0)
{
ssize_t
validate;
if (*option == '+')
break;
i++;
if (i == (ssize_t) argc)
ThrowValidateException(OptionError,"MissingArgument",option);
validate=ParseCommandOption(MagickValidateOptions,MagickFalse,
argv[i]);
if (validate < 0)
ThrowValidateException(OptionError,"UnrecognizedValidateType",
argv[i]);
type=(ValidateType) validate;
break;
}
if ((LocaleCompare("version",option+1) == 0) ||
(LocaleCompare("-version",option+1) == 0))
{
(void) FormatLocaleFile(stdout,"Version: %s\n",
GetMagickVersion((size_t *) NULL));
(void) FormatLocaleFile(stdout,"Copyright: %s\n\n",
GetMagickCopyright());
(void) FormatLocaleFile(stdout,"Features: %s\n\n",
GetMagickFeatures());
return(0);
}
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
default:
ThrowValidateException(OptionError,"UnrecognizedOption",option)
}
}
timer=(TimerInfo *) NULL;
if (iterations > 1)
timer=AcquireTimerInfo();
reference_image=ReadImage(image_info,exception);
tests=0;
fail=0;
if (reference_image == (Image *) NULL)
fail++;
else
{
if (LocaleCompare(image_info->filename,ReferenceFilename) == 0)
(void) CopyMagickString(reference_image->magick,ReferenceImageFormat,
MaxTextExtent);
(void) AcquireUniqueFilename(reference_filename);
(void) AcquireUniqueFilename(output_filename);
(void) CopyMagickString(reference_image->filename,reference_filename,
MaxTextExtent);
status=WriteImage(image_info,reference_image);
InheritException(exception,&reference_image->exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)
fail++;
else
{
(void) FormatLocaleFile(stdout,"Version: %s\n",
GetMagickVersion((size_t *) NULL));
(void) FormatLocaleFile(stdout,"Copyright: %s\n\n",
GetMagickCopyright());
(void) FormatLocaleFile(stdout,
"ImageMagick Validation Suite (%s)\n\n",CommandOptionToMnemonic(
MagickValidateOptions,(ssize_t) type));
if ((type & ColorspaceValidate) != 0)
tests+=ValidateColorspaces(image_info,&fail,exception);
if ((type & CompareValidate) != 0)
tests+=ValidateCompareCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & CompositeValidate) != 0)
tests+=ValidateCompositeCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & ConvertValidate) != 0)
tests+=ValidateConvertCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & FormatsInMemoryValidate) != 0)
{
(void) FormatLocaleFile(stdout,"[pixel-cache: memory] ");
tests+=ValidateImageFormatsInMemory(image_info,reference_filename,
output_filename,&fail,exception);
(void) FormatLocaleFile(stdout,"[pixel-cache: memory-mapped] ");
memory_resource=SetMagickResourceLimit(MemoryResource,0);
tests+=ValidateImageFormatsInMemory(image_info,reference_filename,
output_filename,&fail,exception);
(void) FormatLocaleFile(stdout,"[pixel-cache: disk] ");
map_resource=SetMagickResourceLimit(MapResource,0);
tests+=ValidateImageFormatsInMemory(image_info,reference_filename,
output_filename,&fail,exception);
(void) SetMagickResourceLimit(MemoryResource,memory_resource);
(void) SetMagickResourceLimit(MapResource,map_resource);
}
if ((type & FormatsOnDiskValidate) != 0)
{
(void) FormatLocaleFile(stdout,"[pixel-cache: memory] ");
tests+=ValidateImageFormatsOnDisk(image_info,reference_filename,
output_filename,&fail,exception);
(void) FormatLocaleFile(stdout,"[pixel-cache: memory-mapped] ");
memory_resource=SetMagickResourceLimit(MemoryResource,0);
tests+=ValidateImageFormatsOnDisk(image_info,reference_filename,
output_filename,&fail,exception);
(void) FormatLocaleFile(stdout,"[pixel-cache: disk] ");
map_resource=SetMagickResourceLimit(MapResource,0);
tests+=ValidateImageFormatsOnDisk(image_info,reference_filename,
output_filename,&fail,exception);
(void) SetMagickResourceLimit(MemoryResource,memory_resource);
(void) SetMagickResourceLimit(MapResource,map_resource);
}
if ((type & IdentifyValidate) != 0)
tests+=ValidateIdentifyCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & ImportExportValidate) != 0)
tests+=ValidateImportExportPixels(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & MontageValidate) != 0)
tests+=ValidateMontageCommand(image_info,reference_filename,
output_filename,&fail,exception);
if ((type & StreamValidate) != 0)
tests+=ValidateStreamCommand(image_info,reference_filename,
output_filename,&fail,exception);
(void) FormatLocaleFile(stdout,
"validation suite: %.20g tests; %.20g passed; %.20g failed.\n",
(double) tests,(double) (tests-fail),(double) fail);
}
(void) RelinquishUniqueFileResource(output_filename);
(void) RelinquishUniqueFileResource(reference_filename);
}
if (exception->severity != UndefinedException)
CatchException(exception);
if (iterations > 1)
{
elapsed_time=GetElapsedTime(timer);
user_time=GetUserTime(timer);
(void) FormatLocaleFile(stderr,
"Performance: %.20gi %gips %0.3fu %ld:%02ld.%03ld\n",(double)
iterations,1.0*iterations/elapsed_time,user_time,(long)
(elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),
(long) (1000.0*(elapsed_time-floor(elapsed_time))));
timer=DestroyTimerInfo(timer);
}
DestroyValidate();
MagickCoreTerminus();
return(fail == 0 ? 0 : 1);
}
| {
"content_hash": "74da772677f569dbcd66f51b7307783a",
"timestamp": "",
"source": "github",
"line_count": 2453,
"max_line_length": 80,
"avg_line_length": 32.19527109661639,
"alnum_prop": 0.5765242165242165,
"repo_name": "Distrotech/ImageMagick",
"id": "551a916aee837f9162f8dc79d896ab3c9fd44e09",
"size": "81705",
"binary": false,
"copies": "3",
"ref": "refs/heads/distrotech-ImageMagick",
"path": "ImageMagick-6/tests/validate.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "32229782"
},
{
"name": "C++",
"bytes": "1380196"
},
{
"name": "CSS",
"bytes": "85423"
},
{
"name": "Objective-C",
"bytes": "26384"
},
{
"name": "Perl",
"bytes": "436370"
},
{
"name": "Shell",
"bytes": "735341"
}
],
"symlink_target": ""
} |
/**
* FederationSeriesTypeComponentInstances.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package gov.va.med.imaging.federation.webservices.types.v3;
public class FederationSeriesTypeComponentInstances implements java.io.Serializable {
private gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType[] instance;
public FederationSeriesTypeComponentInstances() {
}
public FederationSeriesTypeComponentInstances(
gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType[] instance) {
this.instance = instance;
}
/**
* Gets the instance value for this FederationSeriesTypeComponentInstances.
*
* @return instance
*/
public gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType[] getInstance() {
return instance;
}
/**
* Sets the instance value for this FederationSeriesTypeComponentInstances.
*
* @param instance
*/
public void setInstance(gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType[] instance) {
this.instance = instance;
}
public gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType getInstance(int i) {
return this.instance[i];
}
public void setInstance(int i, gov.va.med.imaging.federation.webservices.types.v3.FederationInstanceType _value) {
this.instance[i] = _value;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof FederationSeriesTypeComponentInstances)) return false;
FederationSeriesTypeComponentInstances other = (FederationSeriesTypeComponentInstances) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.instance==null && other.getInstance()==null) ||
(this.instance!=null &&
java.util.Arrays.equals(this.instance, other.getInstance())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getInstance() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(getInstance());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(getInstance(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(FederationSeriesTypeComponentInstances.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:v3.types.webservices.federation.imaging.med.va.gov", ">FederationSeriesType>component-instances"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("instance");
elemField.setXmlName(new javax.xml.namespace.QName("", "instance"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:v3.types.webservices.federation.imaging.med.va.gov", "FederationInstanceType"));
elemField.setNillable(false);
elemField.setMaxOccursUnbounded(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| {
"content_hash": "fe48d12ce973ff6713551d5a1c041632",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 162,
"avg_line_length": 35.14705882352941,
"alnum_prop": 0.6376569037656904,
"repo_name": "VHAINNOVATIONS/Telepathology",
"id": "60b292b7ecab972b963c0de8c194768fe7cb736d",
"size": "4780",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Java/FederationCommon/main/src/java/gov/va/med/imaging/federation/webservices/types/v3/FederationSeriesTypeComponentInstances.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "572128"
},
{
"name": "FreeMarker",
"bytes": "32711"
},
{
"name": "Genshi",
"bytes": "605869"
},
{
"name": "HTML",
"bytes": "1939"
},
{
"name": "Java",
"bytes": "13534272"
},
{
"name": "XSLT",
"bytes": "73234"
}
],
"symlink_target": ""
} |
Aspect.build('binder', {
name: 'Binder',
description: 'enjoys tying up or restraining others.',
refutes: [
{ aspect:'emancipator' },
],
consentThresholdModifiers: {
obscenity: 2,
},
});
| {
"content_hash": "c929d602d2e6152e9caecae5a062253e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 20.6,
"alnum_prop": 0.6262135922330098,
"repo_name": "maldrasen/archive",
"id": "85557edc769dc4042a4fc959fa4d89dba10af5bd",
"size": "206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jadefire-0.1/engine/models/aspects/binder.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "230920"
},
{
"name": "HTML",
"bytes": "1056213"
},
{
"name": "JavaScript",
"bytes": "2161778"
},
{
"name": "Ruby",
"bytes": "722167"
},
{
"name": "Shell",
"bytes": "442"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.